This example shows how to create and configure the ASPxGridView control dynamically at runtime.
Follow the steps below to create the control in code.
- Call the control type constructor.
- Specify the control's
ID
property. - Attach event handlers.
- Specify the control's properties.
- Insert the control into the control hierarchy.
- Bind the control to data.
protected void Page_Init(object sender, EventArgs e) {
ASPxGridView grid = new ASPxGridView();
grid.ID = "grid";
grid.KeyFieldName = "ID";
grid.DataSource = GetData();
this.form1.Controls.Add(grid);
grid.DataBind();
}
Default.aspx.cs (VB: Default.aspx.vb)
- How to create and configure a HyperLink column at runtime
- How to create a DataItemTemplate for a column at Runtime
- How to create a master-detail grid at runtime
- How to dynamically switch the Grid's data source and recreate columns at runtime
- How to create columns and bind the control to different data sources at runtime
- How to bind the GridViewDataComboBoxColumn edit form editor at runtime
- How to bind the control created in design mode to different data sources at runtime
- How to bind a grid created at runtime to different data sources
- How to edit a DataTable stored in ViewState at runtime
- How to edit data in a DataTable at runtime when data is stored in Session
- How to load UserControl within EditFormTemplate at runtime
- How to switch date formats for the GridViewDataDateColumn at runtime
(you will be redirected to DevExpress.com to submit your response)