gridviewlinqdatasource

LinqDataSource does not support the Select property when the Delete, Insert or Update operations are enabled


I am getting this error when clicking the Delete button / link in a GridView control.

LinqDataSource [DataSource] does not support the Select property when the Delete, Insert or Update operations are enabled

I don't really understand why I'm getting this error because I have already done the same thing on a different webpage in my site, however the table that the data is read from in that case does not have any foreign keys, this one does. Is that why I am getting the error?

If it matters, the AutoGenerateDeleteButton property is set to True and I am using a linqdatasource to retrieve the data from the database.

Any input would be appreciated :)


Solution

  • In the end I had to select all of the data (using the * option in the DataSource wizard), then remove the columns that I didn't want to display in the GridView. This might be a little inefficient, but it worked.