ASP.NET Web Forms DropDownList has a SelectedValue which is invalid because it does not exist in the list of items

前端 未结 6 947
孤独总比滥情好
孤独总比滥情好 2021-02-02 15:05

First of all there has been questions ( DropDownList has a SelectedValue which is invalid because it does not exist in the list of items , DropDownList "has a SelectedValue

6条回答
  •  你的背包
    2021-02-02 15:46

    Because there is no any datasource when your page is reloaded (postback happened), you should add SqlDataSource control in your .aspx file even in reloading page recognize DropDownList's DataSource. Then You can use InsertCommand, UpdateCommand, DeleteCommand and SelecCommand to obtain your DB.

提交回复
热议问题