Hi Friends,
i have one requirement ie i want put checkbox in datagrid not in datagridview.
i created datagrid table like below.
and you know the solution please modify and send me.
otherwise please give me any idea.
DataTable dt = new DataTable("MyDataTable");
//Create columns and add to DataTable;
DataColumn dcID = new DataColumn("R_NAME");
dt.Columns.Add(dcID); //ID column created and add to DataTable
DataColumn dcSomeText = new DataColumn("R_Check");
dt.Columns.Add(dcSomeText); //LastName column created and add to DataTable
//Now Add some data to the DataTable
DataRow dr;
string[] str11 =new string[ ds.Tables[0].Rows.Count-1];
for (int i = 0; i <= str11.Length; i++)
{
dr = dt.NewRow();
//str11[0] = ds.Tables[0].Rows[i][1].ToString();
dr["R_NAME"] = ds.Tables[0].Rows[i][1].ToString();
dr["R_Check"] = ds.Tables[0].Rows[i][2].ToString() + i;
dt.Rows.Add(dr);
}
return dt;
}
please modify and send me the solution.
Thanks
Venkat.S
Loading

Venkat SPosted Jun 23, 2011, 9:13 AM
Thanks for replay.
ya its ok but i want same like that in windowsmobile forms.
here there is no design part all are in dynamically created.
Posted Jun 23, 2011, 9:01 AM
DataTable ActiveProducts = new DataTable();
ActiveProducts.Columns.Add(new DataColumn("Checked",Type.GetType("System.Boolean")));
ActiveProducts.Columns.Add(new DataColumn("ID", Type.GetType("System.Int32")));
ActiveProducts.Columns.Add(new DataColumn("Name"));
DataRow currentRow = ActiveProducts.NewRow();
for (int i = 1; i < 6; i++)
{
currentRow = ActiveProducts.NewRow();
currentRow["Name"] = "Product - " + i.ToString();
currentRow["ID"] = i;
currentRow["Checked"] = false;
ActiveProducts.Rows.Add(currentRow);
}
DG1.DataSource = ActiveProducts;
DG1.DataBind();
-----------------------------
CellPadding="3" Font-Names="Calibri" Font-Size="Small" GridLines="Horizontal">