我想在用户选择下拉列表后禁用我的下拉列表。所以,如果用户进入这个页面,用户只会进入
- 当他们没有选择之前
- 所选项目的值,如果他们以前选择过,但不能再次选择(表示:已禁用)
https://i.stack.imgur.com/H7uYT.png
因为这里的每个选定项目都会触发对下一页的一些计算。
你有做这件事的教程吗?或者你能帮我解决这个问题吗?
只需将DowpDownList
的AutoPostBack
属性设置为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
}