Click here to Skip to main content
14,241,004 members
Rate this:
Please Sign up or sign in to vote.
See more:
Int32 index = 0;
DataTable dt = new DataTable();
DataRow dr;
dt.Columns.Add("Name", typeof(string));
dt.Columns.Add("Description", typeof(string));
dt.Columns.Add("MRP", typeof(int));
dt.Columns.Add("QTY", typeof(int));
dt.Columns.Add("Discount", typeof(int));
dt.Columns.Add("IndentESM", typeof(int));
dt.Columns.Add("IndentReviewer", typeof(int));
dt.Columns.Add("IndentFinal", typeof(int));
foreach (GridViewRow gvr in GridView1.Rows)
if (((CheckBox)gvr.FindControl("CheckBox1")).Checked == true)
dr = dt.NewRow();
dr["Name"] = GridView1.Rows[index].Cells[2].Text;
dr["Description"] = GridView1.Rows[index].Cells[3].Text;
dr["MRP"] = 0;
dr["QTY"] =1;
dr["Discount"] = 0;
dr["IndentESM"] = 0;
dr["IndentReviewer"] = 0;
dr["IndentFinal"] = 0;

//Do stuff with checked row
gvr.Visible = false;


GridView2.DataSource = dt.DefaultView;

GridView2.EditIndex = 5;


1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

You need to define TemplateFields for edit feature, thus have to define columns before hand.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100