日期:2014-05-18  浏览次数:20464 次

detailsview 下拉联动
如题:detailsview insert mode 中有两个下拉列表框,如何让他们联动,联动效果有刷新的也没问题.
我现在搞不懂第二个下拉框如何取得第一个下拉的seletedvalue,


------解决方案--------------------
给DropDownList1绑定一个事件SelectedIndexChanged,如下:
HTML code
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">
</asp:DropDownList>

------解决方案--------------------
抓DropDownList1可以这样
C# code
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        DropDownList ddl1 = (DropDownList)sender;
        DropDownList ddl = (DropDownList)DetailsView1.FindControl("DropDownList2");
    }