Mark
Mark

Reputation: 2760

file upload inside update panel loses the file in asp.net

I have a update panel in a page and Whenever a value is selected from the dropdown box I display some text on the page, I have set triggers for the drop down, even after doing it the page does a post back when i change the drop down value, where am i going wrong

 <asp:UpdatePanel ID="UP_DDL" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
    <ContentTemplate>
          <asp:FileUpload ID="File_Audio" runat="server"  />
          <asp:DropDownList ID="ddl_SendAt" runat="server" AutoPostBack="true" 
                                            OnSelectedIndexChanged="ddl2_SelectedIndexChanged">
           <asp:ListItem Selected="True">Now</asp:ListItem>
           <asp:ListItem>After 1 Hour</asp:ListItem>
             </ContentTemplate>
      <Triggers>
          <asp:AsyncPostBackTrigger ControlID="ddl_SendAt" EventName="SelectedIndexChanged" />                                
      </Triggers>
 </asp:UpdatePanel>

I want the DropDownList to make a postback to display contents in text box, but I have a file upload button as well. When I select a file from computer and change the dropdown list a post back happens and the file upload loses the file

Upvotes: 2

Views: 4883

Answers (2)

Remy
Remy

Reputation: 12703

I would bascially not recommend a FileUpload control inside an UpdatePanel. A file upload normally needs a full postback.

Except if you implement your file upload inside a frame.

Upvotes: 3

Curtis
Curtis

Reputation: 103358

Check that your ScriptManager's EnablePartialRendering property is not set to False, and remove it or set it to True

Upvotes: 0

Related Questions