The ASP.Net DropDownList’s FindByValue method always returns null when it is bound to a SqlDataSource control.
But, if the DropDownList bound to a DataTable, FindByValue is working as expected.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Below is the source of the problem, I posted above, and the solution,
The DropDownList was inside a panel that was initially hidden, so the DropDownList didnot get bound to the SqlDataSource when the
FindByValueis executed in a Button Click Event.I solved the problem by forcing DropDownList to bind to the DataSource using
DataBound()ofDropDownList in the Page_Load Event Handler.