单击“链接”按钮时需要显示 MODALPOPUP 扩展器

发布于 2025-01-01 23:33:42 字数 134 浏览 0 评论 0 原文

单击“链接”按钮时需要显示 MODALPOPUP 扩展器,并且在模态弹出扩展器中,我们需要向所需的邮件 ID 持有者发送电子邮件。

是否有任何规范和功能可以在 ASP.NET 和 C# 中使用。请给我推荐最好的。

提前致谢

Need to show MODALPOPUP Extender while clickig on Link button and in modal pop up extender we need to get send an email to the required mail ID holder.

Is there any specifications and functionality to use in ASP.NET with C#.Please suggest me the best.

Thanks in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

夜雨飘雪 2025-01-08 23:33:42

首先,在要从中发送邮件的 aspx 页面的代码后面添加下面提到的命名空间。

using System.Net.Mail;

 protected void Button1_Click(object sender, EventArgs e)
    {
      MailMessage mail = new MailMessage();
      mail.To.Add("Email ID where email is to be send");
      mail.To.Add("Another Email ID where you wanna send same email");
      mail.From = new MailAddress("[email protected]");
      mail.Subject = "Email using Gmail";

      string Body = "Hi, this mail is to test sending mail"+ 
                    "using Gmail in ASP.NET";
      mail.Body = Body;

      mail.IsBodyHtml = true;
      SmtpClient smtp = new SmtpClient();
      smtp.Host = "smtp.gmail.com"; //Or Your SMTP Server Address
      smtp.Credentials = new System.Net.NetworkCredential
           ("[email protected]","YourGmailPassword");
    //Or your Smtp Email ID and Password
      smtp.EnableSsl = true;
      smtp.Send(mail);
    }

要发送邮件,请尝试使用 C# 中的上述代码

单击按钮打开 Modalpopup 扩展程序

<div id="hiddenDiv" style="display:none; visibility:hidden;">
  <asp:Button runat="server" ID="hiddenButton" />
/div>

<ajaxToolkit:ModalPopupExtender ID="ModalPopupExtenderID" runat="server"
  BehaviorID="ModalPopupBehaviorID"
  TargetControlID="hiddenButton"
  PopupControlID="ModalContainer"
  />

...

//Javascript
var modalPopupBehaviorCtrl = $find('ModalPopupBehaviorID');
modalPopupBehaviorCtrl.show();

First of all add below mentioned namespace in code behind of aspx page from which you want to send the mail.

using System.Net.Mail;

 protected void Button1_Click(object sender, EventArgs e)
    {
      MailMessage mail = new MailMessage();
      mail.To.Add("Email ID where email is to be send");
      mail.To.Add("Another Email ID where you wanna send same email");
      mail.From = new MailAddress("[email protected]");
      mail.Subject = "Email using Gmail";

      string Body = "Hi, this mail is to test sending mail"+ 
                    "using Gmail in ASP.NET";
      mail.Body = Body;

      mail.IsBodyHtml = true;
      SmtpClient smtp = new SmtpClient();
      smtp.Host = "smtp.gmail.com"; //Or Your SMTP Server Address
      smtp.Credentials = new System.Net.NetworkCredential
           ("[email protected]","YourGmailPassword");
    //Or your Smtp Email ID and Password
      smtp.EnableSsl = true;
      smtp.Send(mail);
    }

For sending mail try the above code in C#

opening the Modalpopup extender on button click

<div id="hiddenDiv" style="display:none; visibility:hidden;">
  <asp:Button runat="server" ID="hiddenButton" />
/div>

<ajaxToolkit:ModalPopupExtender ID="ModalPopupExtenderID" runat="server"
  BehaviorID="ModalPopupBehaviorID"
  TargetControlID="hiddenButton"
  PopupControlID="ModalContainer"
  />

...

//Javascript
var modalPopupBehaviorCtrl = $find('ModalPopupBehaviorID');
modalPopupBehaviorCtrl.show();
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文