假如aa.aspx页面中有一个textbox,一个button

bb.aspx页面中也有一个textbox.button,现在点aa.aspx的button,弹出bb.aspx,在bb页textbox输入值,点button后关闭bb页,aa页中的textbox被赋值为bb页textbox的值。

实现:

aa.aspx.cs:

if (!Page.IsPostBack)
        {
            ImageButton1.Attributes.Add("onclick", "javascript:TextBox1.value=window.showModalDialog('cinfo.aspx',TextBox1.value,'resizable=yes');");
        }

bb.aspx.cs:

if (!Page.IsPostBack)
        {
           Button2.Attributes.Add("onclick", "javascript: window.returnValue=TextBox1.value;self.close();");
        }

为防止bb页提交打开新页面可以在<head></head>之间加入一行:<base target="_self">

相关文章:

  • 2022-12-23
  • 2021-09-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-10
  • 2021-10-23
  • 2022-12-23
  • 2021-11-19
  • 2021-06-06
  • 2021-08-11
相关资源
相似解决方案