Hi Ahmed,
Sorry for the delay in getting back to you.
I here with attached a sample to overcome the issue you are encountering. with these changes you can bind the grid any where in the page i.e, ''pageLoad or on any
other control''s event''
InitializingGridWorkAroundWithTemplates.zip
Here is the description of the sample:
---------------------------------------------------------
We programatically create the Connection, OleDbDataAdapter and DataSet. Then we point the grid''s DataSource as this DataSet.
We bind the grid with no records at the first load in Init( this is essential because the grid has to get its schema at Init)
We use session variable to maintain the Lastselected Value(''SupplierId'' in this sample) used for query.
Here in the sample attached we fill the grid on a button click based on SupplierID ,
so we store this ''SupplierID'' in the Session Variable and then in Every postback we fill the grid with the same data in Init,
(by passing the sessionID) and so editing and other features will also work fine.
The select command of the adapter get its select criteria from the session variable to fill the adapter and then bind the grid with its dataset.
I included a unbound column for holding the checkboxes, this checkbox will store the value
in viewstate accross postbacks !!!.
Hope the sample is pretty simple to understand, so by seeing the sample it should help you to implement in your project (Please let me know if I have to modify anything more)
Note:
--------
We used ''OleDbDataAdapter'' to fill the ''Dataset'' which is the datasource of the grid.
We have used the ''Nwind'' database which points to our syncfusion virtual directory so if you have syncfusion installed in your machine ,
by modifying the webinfo file and making the sample as application, making some necessary register tag prefix chanes in aspx file
the sample should run on your machine
Let me know if you have any queries.
Best Regards,
A.Sivakumar