I have AspxGridView on my page. I want users to be able to set up some data on the web form, and after they press one button, the data from screen is being read, validated and bussines object is being created. This object has a GetData() function, and returns an array of objects representing rows in a grid.
I want ASPXGrid not to populate, until user clicks the button. I know I can set DataSourceId in design time to null – but then I lost availability of synchronizing grid columns with object properties (I cannot add or edit some column properties for new columns). I know I can intercept ObjectCreating event and provide grid with an fake object returning empty data sets. But are there any more elegant solutions?
0
votes
I'm afraid you need to clarify a bit. What is populating the gridview exactly? And when exactly do you want to prevent it from being populated?
- Harv
Populating the gri - i.e. filling it with data. I do not want to do it on loading the page. I want to have more elegant solution then nulling DataSourceId in design time, and then setting it after user clicks the appropriate button.
- smok1
So, the idea is that you want to set the datasource and have the blank grid with the headers, but not have it populated with data? Because otherwise you could just set the visibility to false on the grid until the button is clicked.
- Harv