protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { DataRowView drv = (DataRowView)e.Row.DataItem; if (drv != null) { Literal ltr = e.Row.FindControl("ltr") as Literal; ltr.Text = drv.Row["Id"].ToString(); if (e.Row.RowIndex == 0) { TextBox oTB = new TextBox(); oTB.ID = "TextBox1"; e.Row.Cells[1].Controls.Add(oTB); oTB = null; } if (e.Row.RowIndex == 1) { Panel p1 = new Panel(); p1.Width = Unit.Pixel(500); p1.Height = Unit.Pixel(200); p1.ScrollBars = ScrollBars.Vertical; CheckBoxList cbl = new CheckBoxList(); cbl.ID = "cbl"; cbl.RepeatColumns = 2; cbl.Items.Add(new ListItem("JAKARTA", "JKT")); cbl.Items.Add(new ListItem("Maharashtra", "MH")); p1.Controls.Add(cbl); e.Row.Cells[1].Controls.Add(p1); } } } }
foreach (GridViewRow row in GridView1.Rows) { TextBox txt = row.FindControl("TextBox1") as TextBox; CheckBoxList cbl = row.FindControl("cbl") as CheckBoxList; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)