Thursday, 19 September 2013

How to CheckBoxList in DataTable show in GridView?

How to CheckBoxList in DataTable show in GridView?

I have a DataTable with tow column like following:
DataTable dTable = new DataTable();
dTable.Columns.Add("col1", typeof(string));
dTable.Columns.Add("col2", typeof(CheckBoxList));
DataRow dRow = dTable.NewRow();
dRow[0] = "A";
CheckBoxList chk = new CheckBoxList();
chk.Items.Add("x");
chk.Items.Add("y");
dRow[1] = chk;
dTable.Rows.Add(dRow);
GridView1.DataSource = dTable;
GridView1.DataBind();
In output GridView only show col1 and col2 not show. how to show
CheckBoxList in col2 ?

No comments:

Post a Comment