Uploader with ModalPopup

Last post 11-25-2009, 6:07 AM by rushiamin. 6 replies.
Sort Posts: Previous Next
  •  11-24-2009, 8:33 AM 57367

    Uploader with ModalPopup

    Hi,
    I am using uploader within a modalpopup. whenever upload is completed it automatically closes the popup which I don't want.
     
    Any thoughts on this?
    Thanks,
    Rushi 
  •  11-24-2009, 8:53 AM 57370 in reply to 57367

    Re: Uploader with ModalPopup

    Rushi,
     
    Which modalpopup are you using?
     
    Can you post the code showing the problem?

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  11-24-2009, 8:56 AM 57371 in reply to 57370

    Re: Uploader with ModalPopup

    Sorry, its ajax modal popup. 
    Here is what I am doing.
    <%@ Register Assembly="CuteWebUI.AjaxUploader" Namespace="CuteWebUI" TagPrefix="cutewebui" %>
     <%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="ajaxToolkit" %>


                <asp:LinkButton ID="btnChangeImage" runat="server" Font-Bold="False"
                    Font-Names="Verdana" Font-Size="Smaller" Font-Underline="True" ForeColor="#003366">Change Photo</asp:LinkButton>

     <asp:Panel ID="pnlImageUpload" style="position:absolute; width:300px;height:140px; top:-1000px; left:-1000px" runat="server" CssClass="modalPopup" BackColor="White">
                                           
                            <div style="text-align:center;">
                            <table>
     <tr>
            <td align="center">
               <asp:Image ID="imgPhoto" runat="server" Height="80" Width="80" BorderColor="Black"
        BorderWidth="1" Visible="true" />
             </td>
        </tr>
        <tr>
            <td align="center">
                <asp:LinkButton ID="btnUploadInvoker" runat="server" Font-Bold="False"
                    Font-Names="Verdana" Font-Size="Smaller" Font-Underline="True" ForeColor="#003366">Change Photo</asp:LinkButton>
                    &nbsp;<asp:LinkButton ID="btnClose" runat="server" Font-Bold="False"
                    Font-Names="Verdana" Font-Size="Smaller" Font-Underline="True" ForeColor="#003366">Close</asp:LinkButton>

            </td>
        </tr>
        <tr>
            <td align="center">
                <asp:LinkButton ID="btnCancelUpload" runat="server" Font-Bold="False" Font-Names="Verdana"
                    Font-Size="Smaller" Font-Underline="True" ForeColor="#003366">Cancel</asp:LinkButton>
            </td>
        </tr>
        <tr>
            <td align="center">
            <cutewebui:Uploader runat="server" ID="uploaderMain" InsertButtonID='btnUploadInvoker' CancelButtonID='btnCancelUpload'
        OnFileUploaded="Uploader_FileUploaded" ProgressBarHeight="10" ProgressPanelWidth="100"
        TempDirectory="~/TempImages" ShowProgressInfo="False" AutoUseSystemTempFolder="False"
        OnUploadCompleted="uploaderMain_UploadCompleted" UploadType="Silverlight">
        <ValidateOption MaxSizeKB="10240" AllowedFileExtensions="jpg,gif,png" />
    </cutewebui:Uploader>
                      </td>
        </tr>
    </table>        
                                
                            </div>
                            
    <asp:HiddenField ID="hiddenPhotoNo" runat="server" />
    <asp:HiddenField ID="hiddenIsDirty" runat="server" />

            </asp:Panel>
            <ajaxtoolkit:ModalPopupExtender ID="uploadModal" runat="server" PopupControlID="pnlImageUpload"
                BackgroundCssClass="modalBackground" TargetControlID="btnChangeImage" CancelControlID="btnClose">
            </ajaxtoolkit:ModalPopupExtender> 
     
     Thanks,
    Rushi 
     
     
     
  •  11-24-2009, 9:17 AM 57376 in reply to 57367

    Re: Uploader with ModalPopup

    Rushi ,
     
    After the files be uploaded , the uploader will fire a javascript OnPostback event , and then post back the form
     
    So the page will refresh , or the content will refresh if you using MS-Ajax .
     
    If you do not want the modal popup UI be refreshed , you need handle the OnPostback event.
     
    Please check this for more about the OnPostback event http://ajaxuploader.com/document/scr/JavaScript-API.htm
     
    if the OnPostback handler return false , the uploader will stop posting the form.
     
    But you also can't let server side FileUploaded event be executed.
     
    In OnPostback event , you can also get the uploader's guid list and handle it.
     
    Please check the MVC samples code .
     
    -----
     
    Another easy way : maybe you can call the ModalPopup1.Show(); in the FileUploaded event to keep the layer open.
     
    Regards,
    Terry
  •  11-24-2009, 9:33 AM 57378 in reply to 57376

    Re: Uploader with ModalPopup

    Ok thanks for that,
    I can use modalPopup.Show() to solve this problem.
     
    I have another question on showing uploader on click event on server side.
    Are there any method available?
    I have a datalist and there is a linkbutton in every row which invokes file uploader currently.
    The problem is it renders row*file uploaders on the page which I don't want.
     Any thoughts?
    Thanks,
    Rushi 
     
  •  11-24-2009, 9:52 AM 57383 in reply to 57378

    Re: Uploader with ModalPopup

    Rushi,
     
    You can provide a radio button on each row , or marked the row as selected (use the datalist/datagrid select row function)
     
    and you can get which row checked/selected in the FileUploaded event.
     
    Regards,
    Terry
     
  •  11-25-2009, 6:07 AM 57415 in reply to 57383

    Re: Uploader with ModalPopup

    Yup that worked. Thanks a lot for your help on this. 
    Rushi 
View as RSS news feed in XML