Skip to content

Create and configure the ASPxGridView control dynamically at runtime

License

Notifications You must be signed in to change notification settings

DevExpress-Examples/asp-net-web-forms-grid-create-at-runtime

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Grid View for ASP.NET Web Forms - How to create the control at runtime

This example shows how to create and configure the ASPxGridView control dynamically at runtime.

Follow the steps below to create the control in code.

  1. Call the control type constructor.
  2. Specify the control's ID property.
  3. Attach event handlers.
  4. Specify the control's properties.
  5. Insert the control into the control hierarchy.
  6. 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();
}

Files to Review

Default.aspx.cs (VB: Default.aspx.vb)

More Examples

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)