Solving “The Select operation is not supported by .. unless the SelectMethod is specified.”

In most cases, You will get that error when you are using a data source control(like ObjectDataSource) without setting it’s SelectMethod  as data source for the DetailsView control.

If you want to display  one record in the detailsView control to allow the user to edit it, then you should set the SelectMethod for the DataSource control,otherwise the detailsView control will not be able to get the record from the underlying datasource.

But what if you are only using the DetailsView for only inserting the records; in that case, you will need to set the DetailsView DefaultMode property to “Insert” and also you will need to set it’s AutoGenerateRows to "false" because by default the detaisView will try to execute the select method of it’s underlying datasource to generate the columns/fields dynamically for you.

 

Hope it helps.

Anas

Shout it

No Comments