Hi, I have a gridview to which i am adding rows dynamically at the click event of a button placed in gridview footer template. When i want to update data. I have to load the gridview with all the rows required. I get the sql table data in the dataset object and then i have to load this in the gridview. How can i do this? Only one row gets loaded when i use this code: DataSet DSContact = DMLObj.Load_DataSet("Usp_LoadData", "ContactPerson", idf); foreach (GridViewRow row in GVContactPerson.Rows) { ((TextBox)row.FindControl("txtContactName")).Text=DSContact.Tables[0].Rows[0]["ContactName"].ToString(); ((TextBox)row.FindControl("txtemail")).Text = DSContact.Tables[0].Rows[0]["ContactEmailID"].ToString(); ((TextBox)row.FindControl("txtmob1")).Text = DSContact.Tables[0].Rows[0]["ContactMobile"].ToString(); Session["contact"] = ((TextBox)row.FindControl("txtContactName")).Text; string pid = Convert.ToString(DMLObj.getid("Select ContactPersonID from tbl_ContactPersonDetails where ContactName='" + Session["contact"].ToString() + "'")); Session["contactID"] = pid; }
After inserting the row, in the same event do
Response.Redirect(Request.Url.AbsoluteUri)
this will refresh the GridView
© COPYRIGHT 2024 ASPSnippets.com ALL RIGHTS RESERVED.