?
Solved

AJAX Loading dialog

Posted on 2009-04-22
1
Medium Priority
?
3,409 Views
Last Modified: 2013-12-17
Hello Experts,

Need to have a loading dialog that displays a gif on button click and then when server has finished working it needs to then disappear and change tabs.. the problem is I donot know how to acheive this..


ASPX
 
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="NewStandardContract.aspx.cs"
    Inherits="Applications_CMAssist_Customers_NewStandardContract" %>
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Assembly="Stimulsoft.Report.Web" Namespace="Stimulsoft.Report.Web" TagPrefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Generate Standard Incentives Contracts</title>
    <style type="text/css">
        .buttonTop
        {
            float: left;
            margin-right: 20px;
            text-align: center;
            color: #2a6ca3;
            font-size: 10px;
            margin-bottom: 5px;
        }
        .RadGrid th input
        {
            margin-top: 0;
            margin-bottom: 0;
            height: 12px;
        }
    </style>
 
    <script type="text/javascript">
        function RowSelected(row) {
 
        }
 
    </script>
 
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <telerik:RadSplitter ID="RadSplitter1" runat="server" FullScreenMode="True" Skin="Vista">
            <telerik:RadPane ID="RadPane1" runat="server">
                <telerik:RadTabStrip ID="RadTabStrip1" runat="server" MultiPageID="RadMultiPage1"
                    SelectedIndex="0" Skin="Office2007">
                    <Tabs>
                        <telerik:RadTab runat="server" PageViewID="RadPageView1" Selected="True" Text="Build Your Contract">
                        </telerik:RadTab>
                        <telerik:RadTab runat="server" PageViewID="RadPageView2" Text="View Your Report">
                        </telerik:RadTab>
                    </Tabs>
                </telerik:RadTabStrip>
                <telerik:RadMultiPage ID="RadMultiPage1" runat="server" Height="800px" SelectedIndex="0">
                    <telerik:RadPageView ID="RadPageView1" runat="server" Height="800px">
                        <div>
                            <asp:SqlDataSource ID="StaffDS" runat="server" ConnectionString="<%$ ConnectionStrings:CMA_project %>"
                                SelectCommand="SELECT staff_data_0_staff_list.UserID, staff_data_0_staff_list.FullName, staff_data_0_staff_list.Phone_Work, staff_data_0_staff_list.Fax_Work, staff_data_0_staff_list.Email_Work, CAST(staff_data_0_cma_offices.Address AS nvarchar(250)) + N' ' + CAST(staff_data_0_cma_offices.Location AS nvarchar(50)) + N' ' + CAST(staff_data_0_cma_offices.State AS nvarchar(3)) + N' ' + CAST(staff_data_0_cma_offices.Postcode AS nvarchar(4)) AS Postal, staff_data_0_cma_offices.OfficeID, shared_lut_cma_nsw_names.LogoLink, staff_data_0_staff_list.CMAID FROM staff_data_0_staff_list INNER JOIN staff_data_0_cma_offices ON staff_data_0_staff_list.OfficeID = staff_data_0_cma_offices.OfficeID INNER JOIN shared_lut_cma_nsw_names ON staff_data_0_staff_list.CMAID = shared_lut_cma_nsw_names.CMAID WHERE (staff_data_0_staff_list.UserName = @UserName)">
                                <SelectParameters>
                                    <asp:SessionParameter Name="UserName" SessionField="UserName" />
                                </SelectParameters>
                            </asp:SqlDataSource>
                            <telerik:RadScriptManager ID="RadScriptManager1" runat="server" OutputCompression="AutoDetect">
                            </telerik:RadScriptManager>
                            <telerik:RadGrid ID="RadGrid12" runat="server" AllowPaging="False" AutoGenerateColumns="False"
                                DataSourceID="StaffDS" EnableAjax="True" EnableOutsideScripts="True" GridLines="None"
                                ShowFooter="True" ShowStatusBar="True" Skin="Vista" ToolTip="Please Select a Staff Member">
                                <ClientSettings AllowColumnsReorder="True" ReorderColumnsOnClient="True">
                                    <Selecting AllowRowSelect="True" />
                                    <ClientEvents OnRowSelected="RowSelected" />
                                </ClientSettings>
                                <MasterTableView Caption="Staff" DataKeyNames="UserID,LogoLink" DataSourceID="StaffDS"
                                    IsFilterItemExpanded="True" PageSize="5">
                                    <RowIndicatorColumn>
                                        <HeaderStyle Width="20px"></HeaderStyle>
                                    </RowIndicatorColumn>
                                    <ExpandCollapseColumn>
                                        <HeaderStyle Width="20px"></HeaderStyle>
                                    </ExpandCollapseColumn>
                                    <Columns>
                                        <telerik:GridBoundColumn AutoPostBackOnFilter="True" CurrentFilterFunction="Contains"
                                            DataField="UserID" DataType="System.Int32" HeaderText="UserID" ReadOnly="True"
                                            SortExpression="UserID" UniqueName="UserID" Display="False">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn AutoPostBackOnFilter="True" CurrentFilterFunction="Contains"
                                            DataField="FullName" HeaderText="Full Name" SortExpression="FullName" UniqueName="FullName">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn AutoPostBackOnFilter="True" CurrentFilterFunction="Contains"
                                            DataField="Phone_Work" HeaderText="Phone Work" SortExpression="Phone_Work" UniqueName="Phone_Work">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="Fax_Work" HeaderText="Fax Work" SortExpression="Fax_Work"
                                            UniqueName="Fax_Work">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn AutoPostBackOnFilter="True" CurrentFilterFunction="Contains"
                                            DataField="Email_Work" HeaderText="Email Work" SortExpression="Email_Work" UniqueName="Email_Work">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="Postal" HeaderText="Postal Address" ReadOnly="False"
                                            SortExpression="Postal" UniqueName="Postal">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="LogoLink" HeaderText="Logo Link" SortExpression="LogoLink"
                                            UniqueName="LogoLink" Display="False" />
                                    </Columns>
                                </MasterTableView>
                                <FilterMenu Skin="Vista" EnableTheming="True">
                                    <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
                                </FilterMenu>
                            </telerik:RadGrid>
                        </div>
                        <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False" DataSourceID="CustomerDetails"
                            EnableAJAX="True" GridLines="None" Skin="Vista" AllowPaging="True" EnableLinqExpressions="False">
                            <ClientSettings AllowColumnsReorder="True" EnablePostBackOnRowClick="true">
                                <Selecting AllowRowSelect="True" />
                                <ClientEvents OnRowSelected="RowSelected" />
                            </ClientSettings>
                            <MasterTableView Caption="Customers Info" 
                                DataKeyNames="EOI_Application_ID,Name_Last,Contract_Number,ArcMap_ContractMapImage" 
                                DataSourceID="CustomerDetails" PageSize="5">
                                <RowIndicatorColumn>
                                    <HeaderStyle Width="20px" />
                                </RowIndicatorColumn>
                                <ExpandCollapseColumn>
                                    <HeaderStyle Width="20px" />
                                </ExpandCollapseColumn>
                                <Columns>
                                    <telerik:GridBoundColumn DataField="EOI_Application_ID" 
                                        HeaderText="EOI_Application_ID" SortExpression="EOI_Application_ID" UniqueName="EOI_Application_ID" Visible="False">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="CustomerID" 
                                        HeaderText="CustomerID" ReadOnly="False" SortExpression="CustomerID" 
                                        UniqueName="CustomerID">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="Contract_Number" 
                                        HeaderText="Contract Number" ReadOnly="False" SortExpression="Contract_Number" 
                                        UniqueName="Contract_Number">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="Commencement_Date" DataFormatString="{0:d}" 
                                        DataType="System.DateTime" HeaderText="Start Date" 
                                        SortExpression="Commencement_Date" UniqueName="Commencement_Date">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="Completion_Date_for_Onground_Works" 
                                        DataFormatString="{0:d}" DataType="System.DateTime" HeaderText="Finish Date" 
                                        SortExpression="Completion_Date_for_Onground_Works" 
                                        UniqueName="Completion_Date_for_Onground_Works">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="Agreement_Termination_Date" 
                                        DataFormatString="{0:d}" DataType="System.DateTime" 
                                        HeaderText="Monitoring End Date" SortExpression="Agreement_Termination_Date" 
                                        UniqueName="Agreement_Termination_Date">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="Offer_Letter_Date" DataFormatString="{0:d}" 
                                        DataType="System.DateTime" HeaderText="Offer Letter Date" ReadOnly="False" 
                                        SortExpression="Offer_Letter_Date" UniqueName="Offer_Letter_Date">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="Purchase_Order_Number" 
                                        DataType="System.Int32" HeaderText="PO Number" 
                                        SortExpression="Purchase_Order_Number" UniqueName="Purchase_Order_Number">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="ArcMap_ContractMapImage" 
                                        HeaderText="MapImage" SortExpression="ArcMap_ContractMapImage" 
                                        UniqueName="ArcMap_ContractMapImage">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="ProjectActionRegister" 
                                        HeaderText="ProjectActionRegister" SortExpression="ProjectActionRegister" 
                                        UniqueName="ProjectActionRegister">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="Name_Last" Display="False" 
                                        HeaderText="Name_Last" SortExpression="Name_Last" UniqueName="Name_Last">
                                    </telerik:GridBoundColumn>
                                </Columns>
                            </MasterTableView>
                            <FilterMenu EnableTheming="True" Skin="Vista">
                                <CollapseAnimation Duration="200" Type="OutQuint" />
                            </FilterMenu>
                        </telerik:RadGrid>
                       
                        <telerik:RadGrid ID="RadGrid2" runat="server" AutoGenerateColumns="False" DataSourceID="CustomerDetails"
                            EnableAJAX="True" GridLines="None" Skin="Vista" AllowPaging="True" EnableLinqExpressions="False">
                            <ClientSettings AllowColumnsReorder="True" EnablePostBackOnRowClick="true">
                                <Selecting AllowRowSelect="True" />
                                <ClientEvents OnRowSelected="RowSelected" />
                            </ClientSettings>
                            <MasterTableView DataKeyNames="CustomerID,ArcMap_ContractMapImage" DataSourceID="CustomerDetails"
                                Caption="Contract Map Image">
                                <RowIndicatorColumn>
                                    <HeaderStyle Width="20px"></HeaderStyle>
                                </RowIndicatorColumn>
                                <ExpandCollapseColumn>
                                    <HeaderStyle Width="20px"></HeaderStyle>
                                </ExpandCollapseColumn>
                                <Columns>
                                    <telerik:GridTemplateColumn HeaderText="Contract Map" UniqueName="ArcMap_ContractMapImage"
                                        DataField="ArcMap_ContractMapImage" SortExpression="ArcMap_ContractMapImage">
                                        <ItemTemplate>
                                            <asp:Image ID="Image2" runat="server" ImageUrl='<%# "~/Portals/Projects/Contract/ArcMap_ContractMapImage/" + Eval("ArcMap_ContractMapImage") %>' />
                                        </ItemTemplate>
                                        <HeaderStyle Width="60px" />
                                    </telerik:GridTemplateColumn>
                                </Columns>
                            </MasterTableView>
                            <FilterMenu Skin="Vista" EnableTheming="True">
                                <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
                            </FilterMenu>
                        </telerik:RadGrid>
                        <asp:SqlDataSource ID="CustomerDetails" runat="server" ConnectionString="<%$ ConnectionStrings:CMA_project %>"
                            
                            
                            
                            SelectCommand="SELECT V_Project_ContractNumber.CustomerID, V_Project_ContractNumber.Contract_Number, customers_data_1_projects.Commencement_Date, customers_data_1_projects.Completion_Date_for_Onground_Works, customers_data_1_projects.Agreement_Termination_Date, customers_data_1_projects.Offer_Letter_Date, customers_data_1_projects.Purchase_Order_Number, customers_data_1_projects.ArcMap_ContractMapImage, customers_data_1_projects.ProjectActionRegister, customers_data_1_projects.EOI_Application_ID, V_Project_ContractNumber.Name_Last FROM customers_data_1_projects INNER JOIN V_Project_ContractNumber ON customers_data_1_projects.ProjectID = V_Project_ContractNumber.ProjectID WHERE (V_Project_ContractNumber.CustomerID = @CustomerID) AND (customers_data_1_projects.ArcMap_ContractMapImage IS NOT NULL)">
                            <SelectParameters>
                                <asp:SessionParameter Name="CustomerID" SessionField="CustomerID" />
                            </SelectParameters>
                        </asp:SqlDataSource>
                        <br />
                        <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Generate" />
                    </telerik:RadPageView>
                    <telerik:RadPageView ID="RadPageView2" runat="server" Width="100%">
                        <cc1:StiWebReport ID="StiWebReport1" runat="server" />
                        <cc1:StiWebViewer ID="StiWebViewer1" runat="server" DatePickerFormat="dd/mm/yyyy"
                            Height="800px" PrintDestination="Direct" RenderMode="UseCache" ShowExportToCsv="False"
                            ShowExportToDbf="False" ShowExportToExcelXml="False" ShowExportToHtml="False"
                            ShowExportToOds="False" ShowExportToOdt="False" ShowExportToXml="False" ToolbarAlignment="Center"
                            ToolBarBackColor="Transparent" ViewMode="WholeReport" Width="1280px" ZoomPercent="90"
                            ContentAlignment="Center" ExcelPageBreaks="True" PdfImageQuality="10" PdfStandardFonts="True"
                            ScrollBarsMode="True" CacheMode="Session" 
                            ExcelUseOnePageHeaderAndFooter="True" ImageFormat="Jpeg" 
                            RtfExportMode="WinWord" />
                    </telerik:RadPageView>
                </telerik:RadMultiPage>
            </telerik:RadPane>
        </telerik:RadSplitter>
    </div>
    </form>
</body>
</html>
 
C#
 
using System;
using System.Collections;
using System.Data;
using System.IO;
using System.Windows.Forms;
using Stimulsoft.Report;
using Telerik.Web.UI;
 
public partial class Applications_CMAssist_Customers_NewStandardContract : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Geek.EOI_Application_ID = RadGrid1.SelectedValue;
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
 
        var dataTable = new DataTable("ContractStaff");
 
        dataTable.Columns.Add("FullName");
        dataTable.Columns.Add("Phone_Work");
        dataTable.Columns.Add("Fax_Work");
        dataTable.Columns.Add("Email_Work");
        dataTable.Columns.Add("Postal");
        dataTable.Columns.Add("LogoLink");
 
        foreach (GridDataItem gridDataItem in RadGrid12.SelectedItems)
        {
            var hashtable = new Hashtable();
            gridDataItem.ExtractValues(hashtable);
 
            var dataRow = dataTable.NewRow();
            foreach (DictionaryEntry entry in hashtable)
            {
                dataRow[entry.Key.ToString()] = entry.Value;
            }
            dataTable.Rows.Add(dataRow);
        }
 
        if (dataTable.Rows.Count > 0)
        {
            dataTable.WriteXml(Server.MapPath("~/Xml/ContractStaff.xml"));
        }
        var testreport = new StiReport();
        try
        {
            testreport.Load(Server.MapPath("~/Reports/NEWStandard_Contract_CMA.mrt"));
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message);
        }
        string serverPath1 = Server.MapPath("~/App_Themes/Images/");
        string serverPath = Server.MapPath("~/Portals/Projects/");
        string Date = DateTime.Today.Day + DateTime.Today.Month + DateTime.Today.Year.ToString();
        testreport.Compile();
        testreport.CompiledReport.DataSources["Customers"].Parameters["@CustomerID"].ParameterValue = Geek.CustomerID;
        testreport.CompiledReport.DataSources["SQLContract"].Parameters["@EOI_Application_ID"].ParameterValue = Geek.EOI_Application_ID;
        testreport.CompiledReport.DataSources["SQLDetails"].Parameters["@EOI_Application_ID"].ParameterValue = Geek.EOI_Application_ID;
        testreport.CompiledReport.DataSources["SQLActivity"].Parameters["@EOI_Application_ID"].ParameterValue = Geek.EOI_Application_ID;
        testreport.CompiledReport.DataSources["SQLMilestone"].Parameters["@EOI_Application_ID"].ParameterValue = Geek.EOI_Application_ID;
        testreport.CompiledReport.DataSources["SQLMnimumStandards"].Parameters["@EOI_Application_ID"].ParameterValue = Geek.EOI_Application_ID;
        testreport.CompiledReport.DataSources["SQLFunding"].Parameters["@EOI_Application_ID"].ParameterValue = Geek.EOI_Application_ID;
        testreport.CompiledReport.DataSources["SQLLots"].Parameters["@EOI_Application_ID"].ParameterValue = Geek.EOI_Application_ID;
        testreport.CompiledReport.DataSources["PFC"].Parameters["@EOI_Application_ID"].ParameterValue = Geek.EOI_Application_ID;
        testreport["MapVariable"] = Path.Combine(serverPath, "Contract/ArcMap_ContractMapImage/" + ((GridDataItem)RadGrid1.SelectedItems[0]).GetDataKeyValue("ArcMap_ContractMapImage").ToString());
        testreport["LogoVariable"] = Path.Combine(serverPath1, "Logos/" + ((GridDataItem)RadGrid12.SelectedItems[0]).GetDataKeyValue("LogoLink").ToString());
        testreport.Render(); testreport.ExportDocument(StiExportFormat.Pdf, Server.MapPath("~/Portals/Projects/Contract/" + ((GridDataItem)RadGrid1.SelectedItems[0]).GetDataKeyValue("Contract_Number") + "_" + ((GridDataItem)RadGrid1.SelectedItems[0]).GetDataKeyValue("Name_Last") + "_LandManagerIncentivesContract" + (Date).ToString() + ".Pdf"));
        StiWebViewer1.Report = testreport;
 
 
    }
}

Open in new window

0
Comment
Question by:Trentos
1 Comment
 
LVL 8

Accepted Solution

by:
Faheem Shaikh earned 2000 total points
ID: 24205049
0

Featured Post

Restore individual SQL databases with ease

Veeam Explorer for Microsoft SQL Server delivers an easy-to-use, wizard-driven interface for restoring your databases from a backup. No expert SQL background required. Web interface provides a complete view of all available SQL databases to simplify the recovery of lost database

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses
Course of the Month16 days, 5 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question