1.DropDownListRoles已经绑定数据。
2.GridView也已经绑定数据。
3.需要根据GridView选定的行,触发DropDownList更改选定的值:
DropDownListRoles.SelectedIndex=DropDownListRoles.Items.IndexOf(DropDownListRoles.Items.FindByText(GridView.SelectedRow.Cells[4].Text.ToString()));
备查。
本文介绍了一种在ASP.NET Web应用程序中实现GridView与DropDownList联动的方法。具体来说,当GridView中的某一行被选中时,DropDownList将更新其选定值为该行中特定单元格的文本内容。
1.DropDownListRoles已经绑定数据。
2.GridView也已经绑定数据。
3.需要根据GridView选定的行,触发DropDownList更改选定的值:
DropDownListRoles.SelectedIndex=DropDownListRoles.Items.IndexOf(DropDownListRoles.Items.FindByText(GridView.SelectedRow.Cells[4].Text.ToString()));
备查。
1785

被折叠的 条评论
为什么被折叠?