求DropDownList联动方法,第一个DropDownList改变属性值时改变第二个DropDownList,然后第二个DropDownList
求DropDownList联动方法,第一个DropDownList改变属性值时改变第二个DropDownList,然后第二个DropDownList触发自己的selectindexchange事件。
我的代码如下
<asp:dropdownlist id="ddl_AllAction" runat="server" AutoPostBack="True"> protected void ChangeAllAction(object sender, System.EventArgs e) { for(int i = 0; i < dg1.Items.Count; i++) { DropDownList ddl_action = (DropDownList)dg1.Items[i].FindControl("ddl_action"); ddl_action.SelectedIndexChanged += new System.EventHandler(this.ChangeAction); ddl_action.AutoPostBack = true; ddl_action.SelectedIndex = ddl_AllAction.SelectedIndex; } }<asp:DropDownList id="ddl_action" runat="server" Width="100%" OnSelectedIndexChanged="ChangeAction" AutoPostBack="True"></asp:DropDownList>