Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
if i will click button of a Gridview then it will select that value in session and display in another gridview and again if i will click then that will display the both value.
Posted

Assign the value of previous session to another session variable..Then update the value of that session...And do as if your reqmt...
 
Share this answer
 
i have written like this and it is displaying the current index value.but i want to store and display prvs ,current value in gridview3.

Within pageLoad written:
if (Session["shoppingSession"] == null)
{
ds = new DataSet();

Session["shoppingSession"] = ds;
}
else
{
ds = (DataSet)Session["shoppingSession"];
ad = new SqlDataAdapter("select *from REG where Stu_Reg= '"+ str +"', cn);
ds = new DataSet();
ad.Fill(ds, "REG");
GridView3.DataSource = ds;
GridView3.DataBind();
}

***********
Within Row_Command:





if (e.CommandName == "Show")
{
GridViewRow grv = (GridViewRow)((Button)e.CommandSource).NamingContainer;
Button btn = (Button)GridView1.Rows[grv.RowIndex].FindControl("Button1");
GridView grd2 = (GridView)GridView1.Rows[grv.RowIndex].FindControl("GridView2");

str = GridView1.Rows[grv.RowIndex].Cells[0].Text;
if (btn.Text == "Expand")
{
ad = new SqlDataAdapter("select *from REG where Stu_Reg='" + str + "'", cn);
ds = new DataSet();
ad.Fill(ds, "REG");
GridView3.DataSource = ds;
GridView3.DataBind();
}
}
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900