获取UpdatePanel外部的TextBox文本

时间:2013-01-07 09:24:39

标签: asp.net ajax updatepanel

   <asp:TextBox ID="TextBox1" runat="server" Height="30px" Width="700px" placeholder="Enter Title" ></asp:TextBox>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>

                            <asp:AjaxFileUpload ID="AjaxUploadImages" runat="server" AllowedFileTypes="jpg,jpeg,png,gif" 
                                onuploadcomplete="AjaxUploadImages_UploadComplete"/>

            </ContentTemplate>
        </asp:UpdatePanel>

我想在OnUploadComplete事件中获取TextBox1的文本,如下所示 -

    protected void AjaxUploadImages_UploadComplete(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e)
    {
       string path = Server.MapPath("~/images/") + e.FileName;
       AjaxUploadImages.SaveAs(path);
       string content = TextBox1.Text.ToString();
    }

1 个答案:

答案 0 :(得分:0)

 protected void AjaxUploadImages_UploadComplete(object sender,AjaxControlToolkit.AjaxFileUploadEventArgs e)
    {
       string path = Server.MapPath("~/images/") + e.FileName;
       AjaxUploadImages.SaveAs(path);
       string content = TextBox1.Text.ToString();
    }