I am trying to generate gridview dynamically from codebehind in asp.net. Grids are being generated correctly but the problem is: I want to add a check box column to the grids, so i add a "col" of type bool. The check box gets showed in the grid on webpage but it is disabled, I mean i cant check or uncheck the checkbox on the webpage. System.Windows.Forms.DataGridViewCheckBoxColumn but it is not found in asp.net application.
Here is the screen shot of webpage.A red icon appears when i try to click on checkbox
DataTable data = db.getDataGrid();
allitems.Merge(data);
DataColumn col = new DataColumn("Add/Remove", System.Type.GetType("System.Boolean"));
data.Columns.Add(col);
col.SetOrdinal(0);
GridView gv = new GridView();
gv.RowCommand += new GridViewCommandEventHandler(this.onRowCommandHandler);
gv.AutoGenerateColumns = true;
gv.CssClass = "table table-bordered table-striped";
gv.DataSource = data;
gv.DataBind();
gridsPlaceholder.Controls.Add(gv);
Aucun commentaire:
Enregistrer un commentaire