Click here to Skip to main content
15,879,326 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi...
I have use One File upload , Dropdown list and Button.But Droplist postback propertiy true i loss fileupload value..See this code.And Solution ME.

XML
<asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
      <Triggers>
        <asp:AsyncPostBackTrigger ControlID="DropDownList1" EventName ="DropDownList1_SelectedIndexChanged" />
        <%--<asp:PostBackTrigger ControlID ="DropDownList1" />--%>
        </Triggers>
        <ContentTemplate>
           <table class="style1">
                <tr>
                    <td>
                        <asp:FileUpload ID="FileUpload1" runat="server" />
                    </td>
                    <td>
                        &nbsp;
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">
                            <asp:ListItem>Select</asp:ListItem>
                            <asp:ListItem>1</asp:ListItem>
                            <asp:ListItem>2</asp:ListItem>
                        </asp:DropDownList>
                    </td>
                    <td>
                        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
                    </td>
                    <td>
                        &nbsp;
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
            </table>
        </ContentTemplate>

    </asp:UpdatePanel>
Posted

you can not retain the value of fileupload control, once the page is reloaded it will lose the file name.
 
Share this answer
 
Comments
Abhai Oza 5-Feb-13 4:38am    
I know But How to get.??
Any Other Way.?
NaVeN Kumar 5-Feb-13 6:26am    
Try to put update panel for dropdown list. Otherwise go through the below link for other ways..

http://www.ironspeed.com/articles/Maintain%20File%20Upload%20Control/Article.aspx
XML
<Triggers>
         <asp:PostBackTrigger ControlID ="DropDownList1" />
       </Triggers>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900