Monday, October 01, 2007

ASP.net Error Both DataSource and DataSourceID are defined on dropdownlist

This is a very interesting Error. I had tried to find the solution using step by step approach. (Sounds funny for a user using Visual Studio.net)

Anyway if I create a control and bind it to a datasource from code behind, every thing is fine. The moment I rename the control and try the code after making necessary changes in code behind, all hell breaks loose. I get the error "Both DataSource and DataSourceID are defined on dropdownlist"


You should just delete the control, comment the code behind code, compile and then try putting the control again. This should work. ASP.net has made me lazy hence I do not want to spend my time looking for the reference causing this error.

No comments: