protected void Gridview1_RowDeleting(object sender, GridViewDeleteEventArgs e) { DataTable dtCurrentTable=new DataTable(); int RowIndex = e.RowIndex; dtCurrentTable = (DataTable)ViewState["CurrentTable"]; dtCurrentTable.Rows.RemoveAt(e.RowIndex); SetPreviousData1(dtCurrentTable); } private void SetPreviousData1(DataTable dtCurrentTable) { int rowIndex = 0; if (dtCurrentTable != null) { DataTable dt = dtCurrentTable; if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { TextBox box1 = (TextBox)Gridview1.Rows[rowIndex].Cells[1].FindControl("TextBox1"); TextBox box2 = (TextBox)Gridview1.Rows[rowIndex].Cells[2].FindControl("TextBox2"); TextBox box3 = (TextBox)Gridview1.Rows[rowIndex].Cells[3].FindControl("TextBox3"); box1.Text = dt.Rows[i]["Column1"].ToString(); box2.Text = dt.Rows[i]["Column2"].ToString(); box3.Text = dt.Rows[i]["Column3"].ToString(); rowIndex++; } } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)