在asp.net c#中,我在gridview中有下拉列表。下拉列表在gridview的所有行中具有相同的值集。如果在一行中选择了某些项目,则应在其他行中禁用所选项目。怎么做?
答案 0 :(得分:0)
可能会在代码下方为您提供帮助。
<asp:DropDownList ID="ddlItem" runat="server"
onselectedindexchanged="ddlItem_SelectedIndexChanged">
</asp:DropDownList>
protected override void OnSelectedIndexChanged(EventArgs e)
{
string strSelectedValue = this.SelectedValue.toString();
foreach(foreach (GridViewRow row in grid.Rows)
{
//Write logic to disable item
((DropDown)row.FindControl("ddlItem")))
}
}