I have 2 girds on same page.
1st grid contains data and have check boxes enabled
i have to copy that data to other gird which is ticked.. on click of a insert button
i have done this ..but it only copies 1 item from gird 1 to second plz help
code done by me
int RowNo = 0;
foreach (GridViewRow row in GridView1.Rows)
{
RowNo = RowNo + 1;
bool Checkbox = ((CheckBox)row.FindControl("CheckBox1")).Checked;
if (Checkbox = true)
{
SqlConnection myConn = new SqlConnection();
myConn.ConnectionString = "Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\eRashshala.mdf;Integrated Security=True;User Instance=True";
myConn.Open();
GridViewRow Row = GridView1.Rows[RowNo - 1];
String Name = Row.Cells[2].Text;
SqlDataAdapter da = new SqlDataAdapter("Select LatinName,IngName,MaterialForm from IngredientInfo Where IngName='" + Name + "'", myConn);
DataSet ds = new DataSet();
da.Fill(ds, "IngredientInfo");
GridView2.DataSource = ds.Tables[0];
GridView2.DataBind();
}