You must Sign In to post a response.
  • Category: ASP.NET

    Fileupload control looses value on postback

    I have webform having following structure. First update panel have fileupload control. Second update panel have dropdownlist along with one panel which contain textbox.Onselected index change of dropdownlist,panel get visible(textbox get visible).But when I browse the file using fileupload and after that I choose to select a value from dropdownlist, fileupload control looses the value. How to handle that?After 2 update panel one calendar control and one button control.I want to save and read the file from button control event

    // Update panel 1 start
    // fileupload control
    // update panel 1 end

    // Update panel 2 start
    // dropdownlist with selected index change event
    // On selected index change textbox get visible
    // update panel 2 end

    // Calender control
    // Generate button
  • #769238

    File upload, and tree view being 2 of the biggies.
    To make it work you should use Triggers/PostbackTrigger

    <asp:UpdatePanel ID="UpdatePanel3" runat="server" >
    <asp:FileUpload ID="FileUpload1" runat="server" />
    <asp:RequiredFieldValidator ID="rfvFileupload" ValidationGroup="validate" runat="server" ErrorMessage="* required" ControlToValidate="FileUpload1" />
    <asp:Buton ID="btnupload" runat="server" Text="Upload" onclick="btnupload_Click"></asp:Button>

    <asp:PostBackTrigger ControlID="btnupload"/>


  • Sign In to post your comments