How to bind RadGrid properly on server-side
Occasionally, some features provided by RadGrid like filtering, sorting or exporting can malfunction without any obvious reason. There is a high chance for this issue to be fixed by implementing a proper way of binding.
Please make sure you are not using DataBind() method to bind the grid.
Performing complex grid operations such as Inserting, Deleting, Updating, Hierarchy relations, Grouping, Exporting, Paging, Sorting, Filtering, etc. require accommodating appropriate database operations. Therefore, we suggest you avoid Simple Databinding and strongly recommend the use of more advanced data binding methods, which automatically handle the aforementioned functions:
Declarative DataSource (DataSourceID property), check out:
- Declarative DataSource - documentation article
- Declarative Relations - live demo
Programmatic Data Binding (NeedDataSource event, and DetailTableDataBind event for hierarchy). You should set the DataSource property only within these event handlers, check out:
- Programmatic Data Binding Using the NeedDataSource Event - documentation article
- Programmatic Hierarchy Binding - live demo
In some scenarios it may be necessary the grid to be refreshed explicitly upon some external action - in such cases please choose to use just the Rebind() method, which will refresh the grid content.