I need to prevent objectdatasource from auloading data and managing that in the code behind . when I remove the SelectMethod , the following problem occurs
The Select operation is not supported by ObjectDataSource 'DataSource' unless the SelectMethod is specified.
this is my objectDataSource
<asp:ObjectDataSource ID="DataSource" runat="server" TypeName="declaration_prod_liste"
EnablePaging="true" StartRowIndexParameterName="startrows"
MaximumRowsParameterName="pagesize"
SelectCountMethod="GetDataSourceCount">
</asp:ObjectDataSource>
You could set/change the
SelectMethodof objectdatasource in an appropriate event in code-behind. For example, in code below this is being done in Page_Load event. But, you need to specify its SelectMethod in html code and then just cancel it inSelecting eventas shown in second code-snippet.I am assuming your objectdata source id is
DataSource1.Also, make sure you specify your SelectMethod in hmtl for objectdatasource.
You could cancel objectdatasource autopouplating by canceling in the
Selecting eventas in code snippet below. Make sure to subscribe to this event in objectdatasource html.Html should look like below.