zoukankan      html  css  js  c++  java
  • asp:DropDownList选择事件出错

    在我们使用asp:DropDownList时会经常遇到选项选择,当选择时触发事件OnSelectedIndexChanged,在该事件中要重新绑定选择项,我们往往会遇到一个OnSelectedIndexChanged不能多次选择的错误,代码可能这样写 ListItem item = this.ddlCurrencyType.Items.FindByText(Currency); if (item != null) { ddlExpCurrency.ClearSelection(); //ddlExpCurrency.SelectedValue = item.Value; item.Selected = true; ddlExpCurrency_OnSelectedIndexChanged(ddlExpCurrency, null); } 要改成 ListItem item = this.ddlCurrencyType.Items.FindByText(Currency); if (item != null) { //ddlExpCurrency.ClearSelection(); ddlExpCurrency.SelectedValue = item.Value; // item.Selected = true; ddlExpCurrency_OnSelectedIndexChanged(ddlExpCurrency, null); } 当用ddlExpCurrency.SelectedItem.Text = item.Text;时会改变绑定的数据
  • 相关阅读:
    作业6
    作业8
    作业7
    作业5
    作业4
    作业3
    作业2
    作业1
    浏览器跨域的细节
    解析node-cors模块
  • 原文地址:https://www.cnblogs.com/GreenGrass/p/2947727.html
Copyright © 2011-2022 走看看