Earn Cash from forex trading and free 5$ for Regiatation.

Sunday, September 21, 2008

Code for creating grid dynamically

UltraWebGrid can be created dynamically from code, without being placed on the form at design-time. To accomplish this, a specific constructor must be used which passes in the Id of the control.

To create the grid dynamically, use the following code:


protected Infragistics.WebUI.UltraWebGrid.UltraWebGrid UltraWebGrid1;
UltraWebGrid1 = new Infragistics.WebUI.UltraWebGrid.UltraWebGrid("UltraWebGrid1");
UltraWebGrid1.Columns.Add("col1", "Column 1");
UltraWebGrid1.Columns.Add("col2", "Column 2");
UltraWebGrid1.Columns.Add("col3", "Column 3");

object [] cells = { "Cell1", "Cell2", "Cell3"};
UltraWebGrid1.Rows.Add(new UltraGridRow(cells));
UltraWebGrid1.Rows.Add(new UltraGridRow(cells));
UltraWebGrid1.Rows.Add(new UltraGridRow(cells));
this.Controls.Add(UltraWebGrid1);

0 comments: