¿
¿ Mahesh Kumar
I have created a datatable as mydatatable and pointed that table to gridview...AM I CORRECT below..
---------------------------------
DataTable myDatatable=new DataTable("ParentTable");
DataColumn myDataColumn=new DataColumn();
DataRow myDataRow;
myDataColumn = new DataColumn();
myDataColumn.DataType = System.Type.GetType("System.Int32");
myDataColumn.ColumnName = "id";
myDataColumn.ReadOnly = true;
myDataColumn.Unique = true;
myDatatable.Columns.Add(myDataColumn);
for (int i = 0; i<= 2; i++)
{
myDataRow = myDatatable.NewRow();
myDataRow["id"] = i;
myDatatable.Rows.Add(myDataRow);
}
Myfirstgrid.DataSource = myDatatable; <------------------------------- pointing my data table to datagrid
---------------------------------------------
---------------------------------
DataTable myDatatable=new DataTable("ParentTable");
DataColumn myDataColumn=new DataColumn();
DataRow myDataRow;
myDataColumn = new DataColumn();
myDataColumn.DataType = System.Type.GetType("System.Int32");
myDataColumn.ColumnName = "id";
myDataColumn.ReadOnly = true;
myDataColumn.Unique = true;
myDatatable.Columns.Add(myDataColumn);
for (int i = 0; i<= 2; i++)
{
myDataRow = myDatatable.NewRow();
myDataRow["id"] = i;
myDatatable.Rows.Add(myDataRow);
}
Myfirstgrid.DataSource = myDatatable; <------------------------------- pointing my data table to datagrid
---------------------------------------------