Reputation: 921
I have an ASP.NET 4.0 web application where users upload videos to the server. I have a FileUpload
control and 2 DropDownList
s.
The user first selects a video to be uploaded from the FileUpload
control after that s/he selects a category from DropDownList1
(category list). After the user selects a category, I fill the second DropDownList
with subcategories.
When I select a file to upload, and select a category from the DropDownList
, the page disconnects from the server after postback. If I do the same scenario without selecting a file to be uploaded, I succesfully fill the second combo.
Here is my code :
<tr>
<td style="text-align: left;" class="style9" colspan="2">
<asp:Label ID="Label1" runat="server" Text="Video" Width="80px"></asp:Label>
<asp:FileUpload ID="FileUploadVideo" runat="server" ViewStateMode="Enabled" />
</td>
<td style="text-align: left;" class="style4">
<asp:Label ID="Label3" runat="server" Text="Category" Width="80px"></asp:Label>
<br />
<asp:DropDownList ID="cmbCategory" runat="server" AutoPostBack="True" OnSelectedIndexChanged="cmbCategory_SelectedIndexChanged">
</asp:DropDownList>
</td>
<td style="text-align: right;">
<asp:Label ID="Label6" runat="server" Text="Subcategory" Width="80px"></asp:Label>
<br />
<asp:DropDownList ID="cmbSubcategory" runat="server">
</asp:DropDownList>
</td>
</tr>
Any help would be appreciated.
Upvotes: 1
Views: 759
Reputation: 11433
Since you're uploading video, I imagine this is erroring out due to the file size. The default max file size for ASP.NET applications is 4MB. You can add something like this to the <system.web>
section of your web.config to increase that deault:
<system.web>
<httpRuntime executionTimeout="240" maxRequestLength="20480" />
</system.web>
This allows, for instance, for a 20MB file to be uploaded.
For more information check out this article: Large file uploads in ASP.NET
Upvotes: 2