简体   繁体   English

使用AJAX更新面板通过ASP.NET发送邮件

[英]Mail sending with ASP.NET using AJAX Update Panel

I have an .aspx page using System.Net.Mail for sending E-Mail messages. 我有一个使用System.Net.Mail发送电子邮件的.aspx页。 A linkbutton click event causes this sending process. 一个linkbutton单击事件导致此发送过程。 As you know, I cant disable LinkButton 's PostBack event. 如您所知,我无法禁用LinkButton的PostBack事件。 It means, when user hits the link, mail sending process occurs, and page posts back. 这意味着,当用户单击链接时,将发生邮件发送过程,并发回页面。 I need to avoid this post back process. 我需要避免此回发过程。 So, I need to use Ajax Update Panel , but actually I'm not really good at ASP.NET. 因此,我需要使用Ajax Update Panel ,但实际上我不太擅长ASP.NET。 My question is, how can I use Ajax Update Panel to send mail without post back? 我的问题是,如何使用Ajax Update Panel发送邮件而无需回发? Here is my LinkButton 's Source: 这是我的LinkButton的来源:

<tr>
   <td>
      <asp:LinkButton class="button" runat="server" OnClick="Button1_Click" ID="bas"><img src="button.png" alt="" />Convert / Cevir</asp:LinkButton>
   </td>
</tr>

You can use update panel like this. 您可以像这样使用更新面板。 Moreover don't forget you create the <asp:scriptmanager> on the page. 此外,请不要忘记在页面上创建<asp:scriptmanager>

<tr>
   <td>
<asp:updatepanel id="updatepnl1" runat="server">
  <contenttemplate>
      <asp:LinkButton class="button" runat="server" OnClick="Button1_Click" ID="bas"><img  src="button.png" alt="" />Convert / Cevir</asp:LinkButton>
  </contenttemplate>
</asp:updatepanel>
   </td>
</tr>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM