我在数据转发器中有一个组合框,我需要从其余重复的组合框中删除组合框的选定值,这样我就可以禁止在多个组合框中多次选择相同的值:
如果 combobox1 选择的值是“john smith”,我需要从其他重复的组合框中删除“john smith”。有什么帮助吗?
<asp:Repeater ID="rptTableMapper" runat="server" DataSourceID="dsSQLColumnNames"
OnItemDataBound="rptTableMapper_ItemDataBound">
<ItemTemplate>
<table width="500px">
<tr>
<td>
<dx:ASPxComboBox ID="cmbCsvColumns" OnSelectedIndexChanged="cmbCsvColumns_SelectedIndexChanged"
runat="server" AutoPostBack="True">
</dx:ASPxComboBox>
</td>
</tr>
</table>
</ItemTemplate>
</asp:Repeater>
后面的代码是
protected void cmbCsvColumns_SelectedIndexChanged(object sender, EventArgs e)
{
string s = ((ASPxComboBox)(sender)).ClientID;
string text = ((ASPxComboBox)(sender)).Text;
for (int i = 0; i < rptTableMapper.Items.Count; i++)
{
ASPxComboBox cmb = (ASPxComboBox)(rptTableMapper.Items[i].FindControl("cmbCsvColumns"));
ListEditItem selectedItem = ((ASPxComboBox)(sender)).SelectedItem;
if (cmb.ClientID != s)
{
}
}
}