2
Answers

How to put checkbox in inside datagrid

Venkat S

Venkat S

13y
4.2k
1
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

Answers (2)
Next Recommended Forum