2013-03-23 169 views
0

由於某種原因更新面板不更新標籤或圖像文件...任何幫助,將不勝感激。該方法正在調用並正在進行文件上傳。AJAX更新面板不工作

ASP:

<asp:UpdatePanel runat="server" UpdateMode="Conditional" ID="UpdateTest"> 
      <ContentTemplate> 
       <asp:Label ID ="lblTemp" runat="server">test</asp:Label> 
       <asp:AsyncFileUpload ID="ImageUpload" runat="server" OnUploadedComplete="ImageUpload_UploadedComplete" /> 

       <label>Image</label><br /> 
       <div style="height:60px; padding-bottom:10px; padding-top:5px; "> 
       <div style="width:55px; float:left;margin-right:10px;"> 
        <asp:Image src="../images/menu_bkg.gif" ID="smallImage" runat="server" Height="60" Width="60" /> 
       </div> 
      </ContentTemplate> 
     </asp:UpdatePanel> 

C#:

protected void ImageUpload_UploadedComplete(object sender, AjaxControlToolkit.AsyncFileUploadEventArgs e) 
{ 
    string filename = System.IO.Path.GetFileName(ImageUpload.FileName); 
    ImageUpload.SaveAs(Server.MapPath("../Uploads/") + filename); 
    smallImage.ImageUrl = "../uploads/" + filename; 
    lblTemp.Text = "hellllo"; 

    UpdateTest.Update(); 
} 

編輯:

我一直在運行更多的測試,它似乎像也許是與AsyncFileUpload的問題。我在UpdatePanel中放置了一個按鈕,並更改了圖像URL和標籤文本。標籤文本塊完美地工作,但是當update()函數被調用時,它將清除asyncfileupload乾淨。看來也許lbltemp和smallImage不能更新?

回答