Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
XML
An issue occur while performing multiFile selection in framework 3.5. I am using 'jquery.MultiFile.js' and 'jquery-1.8.2.js' scripts to achieve it. My attachment control is inside a update panel within Tab control. Everything is fine but when i am use async or full post back then file uploader control can not read script and can not select multiple files. My Code part is as follows :


<script src="../Scripts/jquery.MultiFile.js" type="text/javascript"></script>
    <script src="../Scripts/jquery-1.8.2.js" type="text/javascript"></script>

    <div class="PageMainTable">
        <ajaxToolkit:TabContainer ID="TabContainer1" runat="server" AutoPostBack="true" ActiveTabIndex="1"
            OnActiveTabChanged="TabContainer1_ActiveTabChanged">
            <ajaxToolkit:TabPanel ID="tb_home" runat="server" HeaderText="Home">
            </ajaxToolkit:TabPanel>
            <ajaxToolkit:TabPanel ID="TabPanel1" runat="server" HeaderText="CSR Registration Process">
                <ContentTemplate>
                    <asp:UpdatePanel ID="up_addupdt" runat="server" UpdateMode="Conditional" >
                        <Triggers>
                            <asp:PostBackTrigger ControlID="btn_save" />

                        </Triggers>
                        <ContentTemplate>
.....
 <tr>
                                    <td class="lbl_text">Attachment:
                                    </td>

                                    <td colspan="4">
                                        <asp:FileUpload ID="FileUpload1"
                                            maxlength="5" runat="server" class="multi" />

                                    </td>
                                    <td align="left" colspan="4">
                                        <asp:Label ID="lbl_attach" runat="server" Text="" Visible="false"></asp:Label>
                                    </td>
                                </tr>
...
 </ContentTemplate>
                        <Triggers>
                            <asp:AsyncPostBackTrigger ControlID="drop_system" EventName="SelectedIndexChanged" />
                        </Triggers>
                    </asp:UpdatePanel>

                </ContentTemplate>
            </ajaxToolkit:TabPanel>


On async post back of drop down (drop_system) file uploader behave normal and could not allow me to select multiple files.

Pls reply to my query as early as possible.
Thanx in advance.
Posted
Updated 30-Jul-15 20:09pm
v2
Comments
Suvendu Shekhar Giri 31-Jul-15 1:19am    
Can you explain, why you think this issue is related to framework 3.5?
Aniiil 31-Jul-15 2:08am    
No its not related to framework. I just want to inform that i am just using 3.5 to achieve multifile selection. And its working properly first time but after control postback or async postback it will not able to select multiple files. It behave like normal file uploader.

1 solution

Upload controls can't be given default file paths for security reasons, so when your updatepanel fires and the upload controls are refreshed, they lose the files they were previously pointing to. That is just how file uploads work, there is nothing you can do about it. Even if this did work, you can't asynchronously upload files in an update panel anyway. The other problem with update panels and external jQuery scripts is that the events you attached originally to make the scripts work now no longer work because the controls they were originally attached to have been destroyed and recreated by the update panel. To fix this you need to change how you attach the events to the controls.

http://forums.asp.net/t/1982846.aspx?How+to+run+javascript+after+updatepanel+execution+completed[^]

Basically...don't use file upload controls inside update panels, find another way to do what you're doing.
 
Share this answer
 
Comments
Aniiil 31-Jul-15 5:13am    
Thanx Sitecore

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