如何从另一个窗口创建一个弹出窗口 [英] how to create a pop up window from another window

查看:82
本文介绍了如何从另一个窗口创建一个弹出窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有人,

这个概念是这样的:当我单击一个按钮时,它应该打开弹出窗口,而在单击tat按钮时,我有另一个按钮,它应该发送邮件并且还必须创建另一个弹出窗口.我是从tat弹出窗口中创建第一个弹出窗口的,我不知道如何创建另一个弹出窗口.
以下是我正在使用的代码

Dear all,

the concept is this when i click a button it should open popup window and in this i am having another button when tat button s clicked,it should sent a mail and also has to create an another popup window. i did first popup window from tat popup window i do not know how to create another popup window
following is the code i am using

protected void btnsubmit_Click(object sender, EventArgs e)
   {
       try
       {
           string fromAddress = "";
           string displayname ="";
           string[] To = { "" };
           string subject = "Contact Us details from .";
           string body = String.Empty;
           body += "Name: " + this.txtname.Value;
           body += Environment.NewLine;
           body += "E-mail: " + this.txtemail.Value;
           body += Environment.NewLine;
           body += "Phone: " + this.txtphone.Value;
           body += Environment.NewLine;
           body += Environment.NewLine;
           bool confirmation = Send_Email.UsingSMTP(fromAddress, displayname, To, null, null, subject, null, body, false);
          
          this.btnsubmit.Attributes.Add("onclick", "javascript:return OpenPopup()");
          
       }
       catch (Exception ex)
       {
           ex.Message.ToString();
       }
       finally
       {
           this.txtname.Value = String.Empty;
           this.txtemail.Value = String.Empty;
           this.txtphone.Value = String.Empty;
       }
   }

推荐答案

在您的代码中删除
this.btnsubmit.Attributes.Add("onclick", "javascript:return OpenPopup()");


现在,您为弹出按钮编写javascrip函数,并将其附加到 onclientclick 属性.


now you write javascrip function for your popup button and attach to your button onclientclick proprty.


这篇关于如何从另一个窗口创建一个弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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