Grid View for ASP.NET Web Forms - How to create columns and bind the control to different data sources at runtime
This example demonstrates how to create columns and bind the ASPxGridView to different data sources at runtime. Select items in the ASPxRadioButtonList control to switch between SQL data sources.
The grid does not have columns in design mode. All columns are added to the grid at runtime according to columns of the bound data source. If the data source has the insert, update, or delete command, the grid displays the command column.
Note that the grid's EnableViewState property is set to false
to avoid exceptions when binding the grid to a data source.
- Default.aspx (VB: Default.aspx)
- Default.aspx.cs (VB: Default.aspx.vb)
- Grid View for ASP.NET Web Forms - How to dynamically switch the Grid's data source and recreate columns at runtime
- Grid View for ASP.NET Web Forms - How to bind the control with autogenerated columns to different data sources at runtime
- Grid View for ASP.NET Web Forms - How to create the control and bind it to different data sources at runtime