GridView中DropDownList联动

 

GridView中DropDownList联动

2010-07-30 00:26 by Jun2009, 228 阅读, 0 评论, 收藏, 编辑

1.在GridView模板列中添加DropDownList并设置AutoPostback属性为true

2.再在DropDownList的SelectedIndexChanged事件里写下面几句话。

DropDownList ddl = (DropDownList)sender; //得到当前的DropDownList
GridViewRow gvr = (GridViewRow)ddl.NamingContainer; //获取对DropDownList的容器引用

//得到gvr后就好办了查找下面的子控件。
DropDownList ddl2 = (DropDownList)gvr.FindControl("DDl2")
再给ddl2绑定数据

转自  http://www.cnblogs.com/Jun2009/archive/2010/07/30/1788354.html

原文地址:https://www.cnblogs.com/sisiblog/p/2821830.html