How to Create a datagrid programatically
// Instantiate the data grid control
System.Web.UI.WebControls.DataGrid DataGrid1 =
new System.Web.UI.WebControls.DataGrid();
// the GetDataSet method executes the Stored procedure and populates a dataset ds
ds = GetDataSet("DynamicDataGridSP1");
// the dataset is used as the data source for our newly created datatrid DataGrid1
DataGrid1.DataSource=ds;
DataGrid1.DataBind();
// DataGrid1 is added to the PlaceHolder
PlaceHolder.Controls.Add(DataGrid1);
System.Web.UI.WebControls.DataGrid DataGrid1 =
new System.Web.UI.WebControls.DataGrid();
// the GetDataSet method executes the Stored procedure and populates a dataset ds
ds = GetDataSet("DynamicDataGridSP1");
// the dataset is used as the data source for our newly created datatrid DataGrid1
DataGrid1.DataSource=ds;
DataGrid1.DataBind();
// DataGrid1 is added to the PlaceHolder
PlaceHolder.Controls.Add(DataGrid1);
Labels: DataGrid

0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home