尽管更新面板,Textbox.text仍未更新

时间:2015-12-31 14:47:17

标签: asp.net textbox onclick updatepanel

我有一个在线表格,用于发送某些收件人的电子邮件。 我有一个文本框,预先填写了一些电子邮件地址。如果对于调试我放了一些文本字符串(见图)

enter image description here

然后按发送按钮(invia)我仍然在tbReceivers.text字段中看到真正的接收器。

protected void btSend_Click(object sender, EventArgs e)
{        
    String txtPath = Path.Combine(Global.TxtPath, "ProssimoAllenamento.Txt");
    StreamWriter sw = new StreamWriter(txtPath);
    sw.Write(tbBody.Text);
    sw.Close();

    String strError;
           if(Email.Send(tbReceivers.Text,Global.eUserType.COACH,"",tbBody.Text, tbSubject.Text, fuAttachment, out strError))
        MessageBox.Show("Email inviata correttamente", this.Page, this);
    else
        MessageBox.Show("Errore invio email: " + strError , this.Page, this);        
} 

因此,通过搜索解决方案,我发现我必须使用updatePanel,scriptmanager并将所有内容都包含在内。但什么都没发生。 关注我的HTML thanx的帮助 帕特里克

<%@ Page Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" Inherits="Altro_Admin_Admin_Coach" Title="Admin Coach" CodeBehind="Admin_Coach.aspx.cs" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="Server">
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>

            <table style="width: 100%">
               <tr>
                    <td style="height: 22px; width: 48px"></td>
                   <td style="height: 22px; width: 730px">
                       <asp:Label ID="Label1" runat="server" Font-Bold="True" Font-Size="X-Large" Text="Prossimo allenamento"></asp:Label>
                   </td>
                   <td style="height: 22px; width: 730px">&nbsp;</td>
                   <td style="height: 22px; width: 730px">&nbsp;</td>
                   <td style="height: 22px"></td>
               </tr>
               <tr>
                   <td style="width: 48px; height: 22px"></td>
                   <td style="width: 730px; height: 22px"></td>
                   <td style="width: 730px; height: 22px">&nbsp;</td>
                   <td style="width: 730px; height: 22px">&nbsp;</td>
                   <td style="height: 22px"></td>
               </tr>
               <tr>
                   <td style="width: 48px">Destinatari</td>
                   <td style="width: 730px">
                       <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
                       <asp:TextBox ID="tbReceivers" runat="server" Height="47px" Width="707px" Font-Size="X-Small" TextMode="MultiLine"></asp:TextBox>


                   </td>
                   <td style="width: 730px">&nbsp;</td>
                   <td style="width: 730px">&nbsp;</td>
                   <td>&nbsp;</td>
               </tr>
               <tr>
                   <td style="width: 48px; height: 29px">Oggetto</td>
                   <td style="width: 730px; height: 29px">
                       <asp:TextBox ID="tbSubject" runat="server" Height="21px" Width="707px"></asp:TextBox>
                   </td>
                   <td style="width: 730px; height: 29px">&nbsp;</td>
                   <td style="width: 730px; height: 29px">&nbsp;</td>
                   <td style="height: 29px"></td>
               </tr>
               <tr>
                   <td style="width: 48px; height: 11px"></td>
                   <td style="height: 11px; width: 730px">
                       <asp:TextBox ID="tbBody" runat="server" Height="344px" Width="707px" TextMode="MultiLine" Style="vertical-align: top;"></asp:TextBox>
                       <br />
                       <asp:FileUpload ID="fuAttachment" runat="server" BackColor="White" Width="715px" />
                   </td>
                   <td style="height: 11px; width: 730px">&nbsp;</td>
                  <td style="height: 11px; width: 730px">&nbsp;</td>
                   <td style="height: 11px"></td>
               </tr>
               <tr>
                   <td style="width: 48px; height: 41px">&nbsp;</td>
                   <td style="height: 41px; width: 730px">
                       <asp:Button ID="btSend" runat="server" Height="45px" OnClick="btSend_Click" Text="INVIA" Width="714px" />
                   </td>
                    <td style="height: 41px; width: 730px">&nbsp;</td>
                   <td style="height: 41px; width: 730px">&nbsp;</td>
                   <td style="height: 41px">&nbsp;</td>
               </tr>
           </table>
       </ContentTemplate>
   </asp:UpdatePanel>

0 个答案:

没有答案