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

前端 未结 6 943
孤独总比滥情好
孤独总比滥情好 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:38

    In my case I had DropdownList in templatedfield of gridview. Now datasource of grid had employeeid item. I have this in stored proceedure, isnull(employeeid,0) for datasource and guess what DropdownListdoes not have a value of 0 on its items; so i changed that to isnull(employeeid,1) because the first item in DropdownListhas employeeid =1 and this solved problem

提交回复
热议问题