2012-02-04 122 views
0

需要顯示MODALPOPUP擴展器,同時點擊鏈接按鈕和模態彈出擴展器,我們需要發送電子郵件到所需的郵件ID持有人。需要顯示MODALPOPUP擴展器,同時點擊鏈接按鈕

是否有任何規格和功能在C#中使用ASP.NET,請給我最好的建議。

在此先感謝

+1

你有什麼話想做到這一點???你的問題關注發送電子郵件或開放madalpopup ...在asp.net發送電子郵件有很多問題..爲更好的回答寫正確的問題.. – 2012-02-04 07:11:40

回答

0

首先加下面提到的代碼命名空間距離要發送郵件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(); 
+0

好吧謝謝你的建議,但需要顯示模式彈出延長器點擊在鏈接按鈕,然後這個代碼來inhandy..please建議我 – mohan111 2012-02-04 07:18:53

+0

chk編輯.... – vini 2012-02-04 07:25:22

+0

你好mam,我已經使用此代碼,但沒有任何顯示在那裏。嘗試聽我的問題,我有鏈接按鈕,通過單擊我需要得到模態彈出extender.i我只是一個起動器... – mohan111 2012-02-04 07:36:00