We help IT Professionals succeed at work.

ModalPopup to display progress

stretch73
stretch73 asked
on
Been working on this all week and feel like I'm close.  I have a fileupload control that allows the user to upload an Excel file.  Once they select the file, an upload button is displayed.  Once they click the upload button, all of the records are inserted into the database.  

I'm trying to display a modalPopup window when the user clicks the upload button.  I can either get it to display the window, or run the actual code behind:

Protected Sub btnUpload_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnUpload.Click
        If Not FileUploadExcel.HasFile Then
            lblMessage.Text = "Please select a file to upload."
            lblMessage.Visible = True

 but I can't get it to do both.  

I just cannot get this little monster to work.  

Help!






<%@ Page Language="VB" MasterPageFile="~/BOS.master" AutoEventWireup="false" CodeFile="Copy of forecastUpload.aspx.vb" Inherits="forecastUpload" title="GRITT - Business Office System" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>


<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<script type="text/javascript" language="javascript">
var modalProgress = '<%= modalProgress.ClientID %>'

Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(beginReq);
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endReq);

function beginReq(sender, args) 
{
    $find(modalProgress).show();
}

function endReq(sender, args) 
{
    $find(modalProgress).hide();
} 
</script>
<div>
<table style="width:100%">
    <tr>
        <td>
            <table id="tblSearchCriteria" class="black1px" style="width:100%" runat="server">
                <tr>
                    <td class="searchTableBlueSpacer" colspan="6"></td>             
                </tr>
                <tr>
                    <td class="searchTableSubHeader" style="width:100px" align="right">Options:&nbsp;</td>
                    <td class="searchTableSubHeader">
                        <asp:Button ID="btnViewUpload" Text="Upload Spreadsheet" runat="server" />&nbsp;
                        <asp:Button ID="btnViewUploaded" Text="View Uploaded" runat="server" />&nbsp;
                        <asp:Button ID="btnViewExceptions" Text="View Exceptions" runat="server" />
                    </td>
                    <td class="searchTableSubHeader" align="right">Paging:&nbsp;</td>
                    <td class="searchTableSubHeader">
                        <ucPaging:ddlPaging id="ddlPaging" runat="server" />
                    </td>
                    <td class="searchTableSubHeader" align="right" id="tdDownload" runat="server">Download:&nbsp;</td>
                    <td style="text-align:center" class="searchTableSubHeader" id="tdExcel" runat="server">
                        <asp:ImageButton style="vertical-align:middle" ID="ibExcel" ImageUrl="~/Images/excel24.gif" AlternateText="Download as Excel" runat="server" />
                    </td>
                </tr>
                <tr>
                    <td class="searchTableBlueSpacer" colspan="6"></td>             
                </tr> 
            </table>
            <br />
            
            <asp:Panel ID="pnlUpload" runat="server">
                <span class="normal9">Please select an Excel file to import:</span>
                <asp:FileUpload ID="FileUploadExcel" CssClass="black1ptSolid8" OnChange="displayUploadButton(this);" runat="server" />
                
            </asp:Panel>
            
            <asp:Label ID="lblMessage" Text="" runat="server" /><br /><br />
            
            <asp:UpdatePanel ID="pnlRecords" runat="server">
                <ContentTemplate>
                <asp:Button ID="btnUpload" Text="Upload File" style="display:none" runat="server" />
                <asp:GridView   
                    ID="gvUploaded" 
                    style="width:100%" 
                    Visible="false"
                    runat="server">
                    <Columns>
                    <asp:TemplateField HeaderText="5 Dot" SortExpression="OrgCode" HeaderStyle-Width="60px" ItemStyle-HorizontalAlign="center" HeaderStyle-HorizontalAlign="center" >
                        <ItemTemplate>&nbsp;
                            <asp:Label ID="lblOrgCode" Text='<%# Eval("OrgCode") %>' Runat="Server"/>
                        </ItemTemplate> 
                    </asp:TemplateField>     
                    <asp:TemplateField HeaderText="Last Name" SortExpression="LastName" HeaderStyle-Width="110px" ItemStyle-HorizontalAlign="center" HeaderStyle-HorizontalAlign="center" >
                        <ItemTemplate>&nbsp;
                            <asp:Label ID="lblLastName" Text='<%# Eval("LastName") %>' Runat="Server"/>
                        </ItemTemplate> 
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="First Name" SortExpression="FirstName" HeaderStyle-Width="110px" ItemStyle-HorizontalAlign="center" HeaderStyle-HorizontalAlign="center" >
                        <ItemTemplate>&nbsp;
                            <asp:Label ID="lblFirstName" Text='<%# Eval("FirstName") %>' Runat="Server"/>
                        </ItemTemplate> 
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Person Number" SortExpression="PersonNumber" HeaderStyle-Width="110px" ItemStyle-HorizontalAlign="center" HeaderStyle-HorizontalAlign="center" >
                        <ItemTemplate>&nbsp;
                            <asp:Label ID="lblPersonNumber" Text='<%# Eval("PersonNumber") %>' Runat="Server"/>
                        </ItemTemplate> 
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Project" SortExpression="ProjectName" HeaderStyle-Width="250px" ItemStyle-HorizontalAlign="center" HeaderStyle-HorizontalAlign="center" >
                        <ItemTemplate>&nbsp;
                            <asp:Label ID="lblProject" Text='<%# Eval("ProjectName") %>' Runat="Server"/>
                        </ItemTemplate> 
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Project Type" SortExpression="ProjectTypeCode" ItemStyle-HorizontalAlign="center" HeaderStyle-HorizontalAlign="center" >
                        <ItemTemplate>&nbsp;
                            <asp:Label ID="lblProjectType" Text='<%# Eval("ProjectTypeCode") %>' Runat="Server"/>
                        </ItemTemplate> 
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Clarity ID" ItemStyle-HorizontalAlign="center" HeaderStyle-HorizontalAlign="center" >
                        <ItemTemplate>&nbsp;
                            <asp:Label ID="lblClarityID" Text='<%# Eval("ClarityID") %>' Runat="Server"/>
                        </ItemTemplate> 
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Jan" ItemStyle-HorizontalAlign="center" HeaderStyle-HorizontalAlign="center" >
                        <ItemTemplate>&nbsp;
                            <asp:Label ID="lblJan" Text='<%# Eval("Jan") %>' Runat="Server"/>
                        </ItemTemplate> 
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Feb"  ItemStyle-HorizontalAlign="center" HeaderStyle-HorizontalAlign="center" >
                        <ItemTemplate>&nbsp;
                            <asp:Label ID="lblFeb" Text='<%# Eval("Feb") %>' Runat="Server"/>
                        </ItemTemplate> 
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Mar"  ItemStyle-HorizontalAlign="center" HeaderStyle-HorizontalAlign="center" >
                        <ItemTemplate>&nbsp;
                            <asp:Label ID="lblMar" Text='<%# Eval("Mar") %>' Runat="Server"/>
                        </ItemTemplate> 
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Apr"  ItemStyle-HorizontalAlign="center" HeaderStyle-HorizontalAlign="center" >
                        <ItemTemplate>&nbsp;
                            <asp:Label ID="lblApr" Text='<%# Eval("Apr") %>' Runat="Server"/>
                        </ItemTemplate> 
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="May" ItemStyle-HorizontalAlign="center" HeaderStyle-HorizontalAlign="center" >
                        <ItemTemplate>&nbsp;
                            <asp:Label ID="lblMay" Text='<%# Eval("May") %>' Runat="Server"/>
                        </ItemTemplate> 
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Jun" ItemStyle-HorizontalAlign="center" HeaderStyle-HorizontalAlign="center" >
                        <ItemTemplate>&nbsp;
                            <asp:Label ID="lblJun" Text='<%# Eval("Jun") %>' Runat="Server"/>
                        </ItemTemplate> 
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Jul" ItemStyle-HorizontalAlign="center" HeaderStyle-HorizontalAlign="center" >
                        <ItemTemplate>&nbsp;
                            <asp:Label ID="lblJun" Text='<%# Eval("Jul") %>' Runat="Server"/>
                        </ItemTemplate> 
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Aug" ItemStyle-HorizontalAlign="center" HeaderStyle-HorizontalAlign="center" >
                        <ItemTemplate>&nbsp;
                            <asp:Label ID="lblJun" Text='<%# Eval("Aug") %>' Runat="Server"/>
                        </ItemTemplate> 
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Sep" ItemStyle-HorizontalAlign="center" HeaderStyle-HorizontalAlign="center" >
                        <ItemTemplate>&nbsp;
                            <asp:Label ID="lblSep" Text='<%# Eval("Sep") %>' Runat="Server"/>
                        </ItemTemplate> 
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Oct" ItemStyle-HorizontalAlign="center" HeaderStyle-HorizontalAlign="center" >
                        <ItemTemplate>&nbsp;
                            <asp:Label ID="lblOct" Text='<%# Eval("Oct") %>' Runat="Server"/>
                        </ItemTemplate> 
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Nov" ItemStyle-HorizontalAlign="center" HeaderStyle-HorizontalAlign="center" >
                        <ItemTemplate>&nbsp;
                            <asp:Label ID="lblNov" Text='<%# Eval("Nov") %>' Runat="Server"/>
                        </ItemTemplate> 
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Dec" ItemStyle-HorizontalAlign="center" HeaderStyle-HorizontalAlign="center" >
                        <ItemTemplate>&nbsp;
                            <asp:Label ID="lblDec" Text='<%# Eval("Dec") %>' Runat="Server"/>
                        </ItemTemplate> 
                    </asp:TemplateField>
                    </Columns>
                </asp:GridView>
                
                <asp:GridView   
                    ID="gvExceptions" 
                    style="width:100%" 
                    EnableTheming="false"
                    CssClass="Grid"
                    AllowSorting="true"
                    AllowPaging="true"
                    PageSize="15" 
                    AutoGenerateColumns="false" 
                    ShowFooter="true"
                    CellSpacing="1"
                    CellPadding="3"
                    HeaderStyle-CssClass="exceptionGridHeaderStyle"   
                    HeaderStyle-Wrap="false" 
                    AlternatingRowStyle-CssClass="GridAltRowStyle" 
                    SelectedRowStyle-CssClass="GridSelectedRowStyle"
                    EmptyDataRowStyle-CssClass="GridEmptyDataRowStyle"
                    PagerStyle-CssClass="GridPagerStyle"
                    PagerSettings-Mode="Numeric" 
                    FooterStyle-CssClass="exceptionGridFooterStyle"
                    FooterStyle-Wrap="False"
                    Visible="false"
                    runat="server">
                    <Columns>
                    <asp:TemplateField HeaderText="Exception" HeaderStyle-Width="150px" ItemStyle-HorizontalAlign="center" HeaderStyle-HorizontalAlign="center" >
                        <ItemTemplate>&nbsp;
                            <asp:Label ID="lblExceptionType" Text='<%# Eval("exceptionType") %>' Runat="Server"/>
                        </ItemTemplate> 
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="5 Dot" SortExpression="OrgCode" HeaderStyle-Width="60px" ItemStyle-HorizontalAlign="center" HeaderStyle-HorizontalAlign="center" >
                        <ItemTemplate>&nbsp;
                            <asp:Label ID="lblOrgCode" Text='<%# Eval("OrgCode") %>' Runat="Server"/>
                        </ItemTemplate> 
                    </asp:TemplateField>     
                    <asp:TemplateField HeaderText="Last Name" SortExpression="LastName" HeaderStyle-Width="110px" ItemStyle-HorizontalAlign="center" HeaderStyle-HorizontalAlign="center" >
                        <ItemTemplate>&nbsp;
                            <asp:Label ID="lblLastName" Text='<%# Eval("LastName") %>' Runat="Server"/>
                        </ItemTemplate> 
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="First Name" SortExpression="FirstName" HeaderStyle-Width="110px" ItemStyle-HorizontalAlign="center" HeaderStyle-HorizontalAlign="center" >
                        <ItemTemplate>&nbsp;
                            <asp:Label ID="lblFirstName" Text='<%# Eval("FirstName") %>' Runat="Server"/>
                        </ItemTemplate> 
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Person Number" HeaderStyle-Width="110px" ItemStyle-HorizontalAlign="center" HeaderStyle-HorizontalAlign="center" >
                        <ItemTemplate>&nbsp;
                            <asp:Label ID="lblPersonNumber" Text='<%# Eval("PersonNumber") %>' Runat="Server"/>
                        </ItemTemplate> 
                    </asp:TemplateField>  
                    <asp:TemplateField HeaderText="Project" SortExpression="ProjectName" HeaderStyle-Width="250px" ItemStyle-HorizontalAlign="center" HeaderStyle-HorizontalAlign="center" >
                        <ItemTemplate>&nbsp;
                            <asp:Label ID="lblProject" Text='<%# Eval("ProjectName") %>' Runat="Server"/>
                        </ItemTemplate> 
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Project Type" SortExpression="ProjectTypeCode" ItemStyle-HorizontalAlign="center" HeaderStyle-HorizontalAlign="center" >
                        <ItemTemplate>&nbsp;
                            <asp:Label ID="lblProjectType" Text='<%# Eval("ProjectTypeCode") %>' Runat="Server"/>
                        </ItemTemplate> 
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Clarity ID" ItemStyle-HorizontalAlign="center" HeaderStyle-HorizontalAlign="center" >
                        <ItemTemplate>&nbsp;
                            <asp:Label ID="lblClarityID" Text='<%# Eval("ClarityID") %>' Runat="Server"/>
                        </ItemTemplate> 
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Jan" ItemStyle-HorizontalAlign="center" HeaderStyle-HorizontalAlign="center" >
                        <ItemTemplate>&nbsp;
                            <asp:Label ID="lblJan" Text='<%# Eval("Jan") %>' Runat="Server"/>
                        </ItemTemplate> 
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Feb"  ItemStyle-HorizontalAlign="center" HeaderStyle-HorizontalAlign="center" >
                        <ItemTemplate>&nbsp;
                            <asp:Label ID="lblFeb" Text='<%# Eval("Feb") %>' Runat="Server"/>
                        </ItemTemplate> 
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Mar"  ItemStyle-HorizontalAlign="center" HeaderStyle-HorizontalAlign="center" >
                        <ItemTemplate>&nbsp;
                            <asp:Label ID="lblMar" Text='<%# Eval("Mar") %>' Runat="Server"/>
                        </ItemTemplate> 
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Apr"  ItemStyle-HorizontalAlign="center" HeaderStyle-HorizontalAlign="center" >
                        <ItemTemplate>&nbsp;
                            <asp:Label ID="lblApr" Text='<%# Eval("Apr") %>' Runat="Server"/>
                        </ItemTemplate> 
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="May" ItemStyle-HorizontalAlign="center" HeaderStyle-HorizontalAlign="center" >
                        <ItemTemplate>&nbsp;
                            <asp:Label ID="lblMay" Text='<%# Eval("May") %>' Runat="Server"/>
                        </ItemTemplate> 
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Jun" ItemStyle-HorizontalAlign="center" HeaderStyle-HorizontalAlign="center" >
                        <ItemTemplate>&nbsp;
                            <asp:Label ID="lblJun" Text='<%# Eval("Jun") %>' Runat="Server"/>
                        </ItemTemplate> 
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Jul" ItemStyle-HorizontalAlign="center" HeaderStyle-HorizontalAlign="center" >
                        <ItemTemplate>&nbsp;
                            <asp:Label ID="lblJun" Text='<%# Eval("Jul") %>' Runat="Server"/>
                        </ItemTemplate> 
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Aug" ItemStyle-HorizontalAlign="center" HeaderStyle-HorizontalAlign="center" >
                        <ItemTemplate>&nbsp;
                            <asp:Label ID="lblJun" Text='<%# Eval("Aug") %>' Runat="Server"/>
                        </ItemTemplate> 
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Sep" ItemStyle-HorizontalAlign="center" HeaderStyle-HorizontalAlign="center" >
                        <ItemTemplate>&nbsp;
                            <asp:Label ID="lblSep" Text='<%# Eval("Sep") %>' Runat="Server"/>
                        </ItemTemplate> 
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Oct" ItemStyle-HorizontalAlign="center" HeaderStyle-HorizontalAlign="center" >
                        <ItemTemplate>&nbsp;
                            <asp:Label ID="lblOct" Text='<%# Eval("Oct") %>' Runat="Server"/>
                        </ItemTemplate> 
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Nov" ItemStyle-HorizontalAlign="center" HeaderStyle-HorizontalAlign="center" >
                        <ItemTemplate>&nbsp;
                            <asp:Label ID="lblNov" Text='<%# Eval("Nov") %>' Runat="Server"/>
                        </ItemTemplate> 
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Dec" ItemStyle-HorizontalAlign="center" HeaderStyle-HorizontalAlign="center" >
                        <ItemTemplate>&nbsp;
                            <asp:Label ID="lblDec" Text='<%# Eval("Dec") %>' Runat="Server"/>
                        </ItemTemplate> 
                    </asp:TemplateField>
                    </Columns>
                </asp:GridView>
                </ContentTemplate>
             </asp:UpdatePanel>
        </td>
    </tr>
</table>

<asp:Panel ID="pnlUpdateProgress" CssClass="updateProgress" runat="server">
	<asp:UpdateProgress ID="UpdateProg1" AssociatedUpdatePanelID="pnlRecords" runat="server">
		<ProgressTemplate>
			<div>
			    <table>
			        <tr>
			            <td><img src="../images/redLoading.gif" style="vertical-align: middle" alt="Processing" /></td>
			            <td>The file is being uploaded, depending on the number of records this may take up to a minute.</td>
			        </tr>
			    </table>
			</div>
		</ProgressTemplate>
	</asp:UpdateProgress>
</asp:Panel>

<cc1:ModalPopupExtender 
    ID="modalProgress" 
    TargetControlID="pnlUpdateProgress"
    PopupControlID="pnlUpdateProgress" 
    BackgroundCssClass="modalBackground"
    runat="server" />
</div>
</asp:Content>

Open in new window

Comment
Watch Question

Commented:
I'm not sure what your code behind looks like, so I can't fix that.  .. but I would do one of two things:

1) pass the file name to your update panel and call the upload code from there
2) use a client side option instead (jquery) to handle the modal popup and file upload

Author

Commented:
That did it!

Thanks,

N