I have set up the ObjectDataSource from the Table Adapter using the Visual Studio 2005 in Design Mode. Now the page comes up fine, but I now want to add some query parameter filed, and do not want to show the grid right when the page comes up.
There may be many ways of fixing it, but so far this technique is working well for me.
- Go to the ObjectDataSource's property and switch to the Events view (the lightening bolt icon on top).
- Double click in Selecting event so that the VS will create an event handler.
- Go to the event handler.
protected void ObjectDataSourceQuives_Selecting(object sender,
if (quiversEnabled == false) e.Cancel = true;
At another point in the code, for example, when the button to query a new quiver is pressed then I would set quiversGridEnabled to true, then subsequent calls to Bind() to the Gridview will show the data based on the query.
Time To Find The Solution:
It took about an hour to find out how I'd do this. If there are better and cleaner ways of doing it, be sure to comment on this entry.