I want to pass all the gridview value into another page I have one gridview in PatientDetails.aspx page and one button as below
As i have seen your previous question also, So i can suggest you one thing, rather than keeping your gridview in session(which is expensive) you can use RowCommand
event, and after having button
here i don't think you need checkbox or chk_CheckedChanged
event, you can pass the PatientID
to your next page there you can write query to insert selected row data to your new table.
protected void gvDoctorList_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "select")
{
int pID = Convert.ToInt32(e.CommandArgument);
// either put ID in session and check
Session["PatientID"] = Convert.ToString(pID);
Server.Transfer("Patientstaticformatrix.aspx");
}
}
On page_Load Event
protected void Page_Load(object sender, EventArgs e)
{
string pID = Convert.ToString(Session["PatientID"]);
if(!string.IsNullOrEmpty(pID))
{
int patientID = Convert.ToInt32(pID);
//Call Stored procedure which will insert this record with this ID
// to another table
}
}