Click here to Skip to main content
15,896,063 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My Run page as follows


My Gridview page code as follows

My Gridview code as follows

C#
protected void Page_Load(object sender, EventArgs e)
{

using (var con = new SqlConnection(ConfigurationManager.ConnectionStrings["himtConnectionString"].ConnectionString))


using (var cmd = new SqlCommand("OH_PKG_DATE_COMBINATION '" + Session["compkgid"].ToString().Trim() + "'", con))

con.Open();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(dt);
GridView1.DataSource = dt;
GridView1.DataBind();
}



Lnk button code as follows

C#
   protect void Link_click(object sender,eventargs e)
{
     popup.show();
}



In Link button from the session variable data will be passed in gridview using the popup.

Link Button (To View Available Batch Date)

When i click the View Available Batch date in Link button Pop up will be shown.

POP up as follows

Show date (Button)

When i click the Show date button in popup then in Gridview date will be displayed.

Then i have one button called Hide Button.

When i click the hide button i want to clear the session variable.

i want to clear Session["compkgid"] values when i click the hide button in popup.

for that how can i do.
Posted
Updated 18-Jul-15 21:56pm
v2

1 solution

Handle the button click (alert of JavaScript?) and clear the value from the Session list of variables.

C#
Session["compkgid"] = null; // set it to null


The main thing is how would you handle the button click, is it ASP.NET Control, is it JavaScript alert box or what? If ASP.NET control, then you can handle the click event on the server-side and add this code in it. Otherwise, if this is JavaScript button then you must send asynchronous (ajax) request to server to clear the Session variable or you can use some form input field to store that state etc.
 
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