选择asp.net网络表单后禁用dropdownloadlist选项



我想在用户选择下拉列表后禁用我的下拉列表。所以,如果用户进入这个页面,用户只会进入

  1. 当他们没有选择之前
  2. 所选项目的值,如果他们以前选择过,但不能再次选择(表示:已禁用)

https://i.stack.imgur.com/H7uYT.png

因为这里的每个选定项目都会触发对下一页的一些计算。

你有做这件事的教程吗?或者你能帮我解决这个问题吗?

只需将DowpDownListAutoPostBack属性设置为true并处理SelectedIndexChanged-事件。在那里你可以禁用它:

protected void Ddl_SelectedIndexChanged(object sender, EventArgs e)
{
    DropDownList ddl = (DropDownList) sender;
    ddl.Enabled = false;
    // store the SelectedValue somewhere, f.e. in the Session
    // or Response.Redirect to the next page and pass it via url-parameter
}

相关内容

  • 没有找到相关文章

最新更新