关闭弹出窗口时删除会话变量

编程入门 行业动态 更新时间:2024-10-09 23:18:06
本文介绍了关闭弹出窗口时删除会话变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我的运行页面如下 我的Gridview页面代码如下 我的Gridview代码如下

My Run page as follows My Gridview page code as follows My Gridview code as follows

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按钮代码如下

Lnk button code as follows

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

来自会话变量数据的链接按钮将在gridview中传递弹出窗口。 链接按钮(查看可用批次日期) 当我点击查看可用时链接按钮弹出的批日期将显示。 弹出如下 显示日期(按钮) 当我点击弹出窗口中的显示日期按钮时,将显示Gridview日期。 然后我有一个名为Hide Button的按钮。 当我点击隐藏按钮时我想清除会话变量。 i想要在弹出窗口中单击隐藏按钮时清除会话[compkgid] 值。 我该怎么办。

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.

推荐答案

处理按钮点击(警告的JavaScript?)并清除会话列表o f变量。 Handle the button click (alert of JavaScript?) and clear the value from the Session list of variables. Session["compkgid"] = null; // set it to null

主要的是你如何处理按钮点击,它是ASP.NET控件,它是JavaScript警告框还是什么?如果是ASP.NET控件,那么您可以在服务器端处理click事件并在其中添加此代码。否则,如果这是JavaScript按钮,则必须向服务器发送异步(ajax)请求以清除Session变量,或者您可以使用某个表单输入字段来存储该状态等。

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.

更多推荐

关闭弹出窗口时删除会话变量

本文发布于:2023-08-06 11:25:08,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1311962.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:变量   弹出窗口

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!