FileUpload Control in Usercontrol
-
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
-
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
-
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
Yes I am doing it. I can get the values of all controls while postback except Fileuploadcontrol.