Asp.NET DropDownList SelectedItem.Value not changing

前端 未结 5 1826
庸人自扰
庸人自扰 2021-01-07 23:40

markup:

            
5条回答
  •  独厮守ぢ
    2021-01-08 00:23

    If you're databinding in Page_Load, you're essentially also resetting the SelectedItem.

    You should wrap whatever binding code that exists in Page_Load inside an if(!IsPostBack) block.

    if(!Page.IsPostBack)
    {
    
        // Your binding code here ...
    
    }
    

提交回复
热议问题