Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. FileUpload Control in Usercontrol

FileUpload Control in Usercontrol

Scheduled Pinned Locked Moved ASP.NET
helpsysadmin
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Milind R Chavan
    wrote on last edited by
    #1

    Hello, I have one Fileupload control in usercontrol. And I am loading usercontrol to in panel within updatepanel of page dynamically. So the scenario is like this : Masterpage --- Default.aspx ---- UpdatePanel --- ASP Panel ---- Usercontrol loaded according to user request. I have loading the usercontrol dynamically , As User can load the usercontrol multiple times I can able generate usercontrol while postback of the page. The problem is, When I click "Upload" button within usercontrol I am not getting postedfile of fileupload I have also tried following method in usercontrol to solve this problem , but no success yet <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="conditional"> <Triggers> <asp:PostBackTrigger ControlID="IbUploadT" /> </Triggers> <ContentTemplate> <asp:FileUpload ID="fupResource" runat="server" EnableViewState="true" /> <asp:ImageButton ID="IbUploadT" runat="server" ImageUrl="~/App_Themes/White/Images/Add.ICO" Height="16px" onclick="IbUploadT_Click" /> </ContentTemplate> </asp:UpdatePanel> Even though the page is postingback , I am not getting the postedfile of Fileupload Please help me. Regards, Milind

    G 1 Reply Last reply
    0
    • M Milind R Chavan

      Hello, I have one Fileupload control in usercontrol. And I am loading usercontrol to in panel within updatepanel of page dynamically. So the scenario is like this : Masterpage --- Default.aspx ---- UpdatePanel --- ASP Panel ---- Usercontrol loaded according to user request. I have loading the usercontrol dynamically , As User can load the usercontrol multiple times I can able generate usercontrol while postback of the page. The problem is, When I click "Upload" button within usercontrol I am not getting postedfile of fileupload I have also tried following method in usercontrol to solve this problem , but no success yet <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="conditional"> <Triggers> <asp:PostBackTrigger ControlID="IbUploadT" /> </Triggers> <ContentTemplate> <asp:FileUpload ID="fupResource" runat="server" EnableViewState="true" /> <asp:ImageButton ID="IbUploadT" runat="server" ImageUrl="~/App_Themes/White/Images/Add.ICO" Height="16px" onclick="IbUploadT_Click" /> </ContentTemplate> </asp:UpdatePanel> Even though the page is postingback , I am not getting the postedfile of Fileupload Please help me. Regards, Milind

      G Offline
      G Offline
      Gamzun
      wrote on last edited by
      #2

      As you're loading your usercontrol dynamically, you've to add it to viewstate dynamically too.

      Please don't forget to mark 'Good Answer', if you find it really a good one! Kashif

      M 1 Reply Last reply
      0
      • G Gamzun

        As you're loading your usercontrol dynamically, you've to add it to viewstate dynamically too.

        Please don't forget to mark 'Good Answer', if you find it really a good one! Kashif

        M Offline
        M Offline
        Milind R Chavan
        wrote on last edited by
        #3

        Yes I am doing it. I can get the values of all controls while postback except Fileuploadcontrol.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups