使用会话ASP.Net传递值 [英] Passing value using session ASP.Net

查看:89
本文介绍了使用会话ASP.Net传递值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我对ASP.net相当陌生.我有一个父页面,可以在其中调用弹出窗口.在弹出窗口中,您可以浏览文件夹路径,然后单击确定"按钮将其传递回父页面,在该父页面中,文件夹路径在文本框中显示.我正在尝试使用Session,但无法弄清楚如何将其发布回父页面.这是来自父级的Page_load的代码

Hi,

I am quite new with ASP.net. I have a parent page where it can call a pop-up window. At the pop-up window you can browse for folder path, and click OK button to pass it back to the parent page where the folder path is displayed in a text box. I am trying to use Session but I cannot figure out how to post it back to the parent page. Here is the code from the Page_load of the parent

protected void Page_Load(object sender, EventArgs e)
        {

            if (!IsPostBack)
            {
                'this.txtRaw.Text = ADSclass.filePath.ToString();
            }
        }



这是弹出窗口中的代码



this is the code from the pop-up window

protected void _selectButton_Click(object sender, EventArgs e)
        {
          Session["path"] = this._browseTextBox.Text.ToString();
          ADSclass.filePath = this._browseTextBox.Text.ToString();//this is a public variable that I declared in a class
        }



任何帮助都可以:)



Any help will do :)

推荐答案

为什么可以在使用新窗口的返回值直接使用Session时使用Session.
本文将为您提供指南:在子窗口关闭时通过AJAX(ASP.NET 2.0)创建父页面-有条件 [
Why use Session when you can do it directly using new window''s return value.
This article will guide: Partial update of parent page via AJAX (ASP.NET 2.0) on close of a child window - conditionally[^]


这篇关于使用会话ASP.Net传递值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆