Both DataSource and DataSourceID are defined in Gridview1

Why would I be getting this error if not using a datasourceid?

via Both DataSource and DataSourceID are defined in Gridview1.

If you have gotten this error before then you probably just migrated your ASP.NET application to a different server with a different database name. I am using Linq to SQL in my code and I think that is where this cryptic error message comes from.

Still hunting for kisses
Creative Commons License photo credit: moggs oceanlane

Don’t look at the answer marked as the answer. Look down the page to the entry by keef_riff_hard. He states

What you need to look for is NOT that you have both the DataSource and DataSourceID defined – but rather see if the value for the DataSource is bad.

This was my issue; bad connection string. Fix it and everything is happy! 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload the CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.