首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

detailsview 下拉联动,该如何处理

2012-01-23 
detailsview 下拉联动如题:detailsview insert mode 中有两个下拉列表框,如何让他们联动,联动效果有刷新的

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");    } 

热点排行