2012-11-20 81 views
1

我有兩個FileUpload控制模式彈出。第一個文件上傳控件很好地將文件保存到服務器。但是,第二個文件上傳控件與第一個文件上載控件完全相同,但是當它上傳文件時,它將以0字節的形式上傳。任何想法可能發生什麼?此外,我在我的updatepanel上有一個觸發器,它修復了在updatepanel內部具有上傳控件的問題。asp.net多文件上傳控件

我的ASP和C#是很簡單

<tr align="center"> 
<td>Editable Doc</td> 
    <td> 
    <asp:FileUpload ID="uploadeditable" runat="server" /> 
    </td> 
</tr> 

這裏是一個落後的不兼容的UpdatePanel

upload.PostedFile.SaveAs(path + "\\" + file); 
+0

這兩個控件都有相同的ID嗎? – Yahia

+0

不,他們沒有。 – user541597

+0

'upload'是指什麼? – Darren

回答

0

控制代碼控制

以下ASP.NET控件不與部分頁面更新兼容,因此在UpdatePanel控件內不受支持:

1. TreeView and Menu controls. 

2. Web Parts controls. For more information, see ASP.NET Web Parts Controls. 

3. FileUpload controls when they are used to upload files as part of an asynchronous postback. 

4. GridView and DetailsView controls when their EnableSortingAndPagingCallbacks property is set to true. The default is false. 

5. Login, PasswordRecovery, ChangePassword, and CreateUserWizard controls whose contents have not been converted to editable templates. 

6. The Substitution control. 

7. Validation controls, which includes the BaseCompareValidator, BaseValidator, CompareValidator, CustomValidator, RangeValidator, RegularExpressionValidator, RequiredFieldValidator, and ValidationSummary control. 

對於您的信息檢查FileUpload1.hasfile它將始終返回false,而在updatepanel中使用。