Post I've tried.
http://www.telerik.com/help/aspnet/ajax/ajxshowloadingpaneloninitialpageload.html
Can anyone look at the code below and let me know what I'm doing incorrect?
<%
@ Page Language="C#" AutoEventWireup="true" CodeBehind="OpenItemsInventory.aspx.cs"
Inherits="Sterling.SNEF.Tax.Web.OpenItemsInventory" %>
<%
@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!
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 runat="server">
<title>Open Items Inventory</title>
<style type="text/css">
.RadGrid_Web20 .rgCommandRow
{
color: #35467C !important;
}
</style>
</
head>
<
telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
<script type="text/javascript">
var rad_val;
function pageLoad(sender, eventArgs) {
if (!eventArgs.get_isPartialLoad()) {
$find(
"<%= RadAjaxManager1.ClientID %>").ajaxRequest("InitialPageLoad");
}
}
function onFutureInventory(sender, args) {
document.getElementById(
'<%= btnFutureInventory.ClientID %>').disabled = true;
GetRadioValue();
var windowURL = "FutureInventoryDialog.aspx?ViewByType=" + rad_val
var oWnd = $find("<%= dlgFutureInventory.ClientID%>");
oWnd.setUrl(windowURL);
oWnd.SetSize(470, 505);
oWnd.show();
oWnd.set_initialBehaviors(Telerik.Web.UI.WindowBehaviors.Close);
oWnd.set_behaviors(Telerik.Web.UI.WindowBehaviors.Close);
oWnd.SetModal(
true);
}
function GetRadioValue()
{
message =
"";
surplusMessage =
"";
if (document.getElementById('<%= rdoAssignee.ClientID %>').checked)
{
rad_val =
"Assignee";
}
else
{
rad_val =
"State";
}
}
function onFutureInventoryClose(sender, eventArgs) {
document.getElementById(
'<%= btnFutureInventory.ClientID %>').disabled = false;
}
function onRequestStart(sender, args)
{
if (args.get_eventTarget().indexOf("ExportToExcelButton") >= 0)
{
args.set_enableAjax(
false);
}
}
</script>
</
telerik:RadCodeBlock>
<
body>
<form id="form1" runat="server">
<telerik:RadScriptManager ID="OpenItemsInventoryScriptManager" runat="server">
</telerik:RadScriptManager>
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
<ClientEvents OnRequestStart="onRequestStart" />
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="Panel1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="Panel1" LoadingPanelID="LoadingPanel" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadWindow ID="dlgFutureInventory" runat="server" Skin="Web20" EnableViewState="False"
KeepInScreenBounds="True" ReloadOnShow="True" ShowContentDuringLoad="False" VisibleStatusbar="False"
Behaviors="None" OnClientClose="onFutureInventoryClose" onclientOverlay="True">
</telerik:RadWindow>
<telerik:RadAjaxLoadingPanel ID="LoadingPanel" runat="server" Skin="Web20">
</telerik:RadAjaxLoadingPanel>
<asp:Panel ID="Panel1" runat="server">
<asp:Panel ID="Panel2" Visible="false" runat="server">
<asp:Label ID="lblLenders" runat="server" Font-Bold="True" Text="Lenders:" Font-Names="Arial"></asp:Label>
<asp:Label ID="Label3" runat="server" Font-Bold="True" Text="Lenders:" Font-Names="Arial"></asp:Label>
<br />
<asp:Label ID="lblViewBy" runat="server" Font-Bold="True" Text="View By:" Font-Names="Arial"></asp:Label>
<asp:RadioButton ID="rdoAssignee" runat="server" Text="Assignee" GroupName="ViewByGroup"
OnCheckedChanged="ViewByGroup_CheckedChanged" Checked="true" AutoPostBack="true"
Font-Names="Arial" Font-Size="Smaller" />
<asp:RadioButton ID="rdoState" runat="server" Text="State" GroupName="ViewByGroup"
OnCheckedChanged="ViewByGroup_CheckedChanged" AutoPostBack="true" Font-Names="Arial"
Font-Size="Smaller" />
<br />
<br />
<div style="border: thin solid #5177B5; left: 5px; position: relative; left: 5px;
width: 760px;">
<table border="1" width="760px" style="border-collapse: collapse;">
<tr>
<td align="center" style="width: 145px; background-color: #7FA5D7;">
<asp:Label ID="lblhdrAssignee" runat="server" Text="Assignee" Font-Bold="True" Font-Names="Arial"
Font-Size="12px" ForeColor="White"></asp:Label>
</td>
<td align="center" style="width: 100px; background-color: #7FA5D7;">
<asp:Label ID="Label2" runat="server" Text="Jurisdictions" Font-Bold="True" Font-Names="arial,sans-serif"
Font-Size="12px" ForeColor="White"></asp:Label>
</td>
<td align="center" style="width: 100px; background-color: #7FA5D7;">
<asp:Label ID="Label6" runat="server" Text="Prior Open Items" Font-Bold="True" Font-Names="Arial"
Font-Size="12px" ForeColor="White"></asp:Label>
</td>
<td align="center" style="width: 100px; background-color: #7FA5D7;">
<asp:Label ID="Label7" runat="server" Text="Current Open Items" Font-Bold="True"
Font-Names="Arial" Font-Size="12px" ForeColor="White"></asp:Label>
</td>
<td align="center" style="width: 110px; background-color: #7FA5D7;">
<asp:Label ID="Label4" runat="server" Text="Items Left to Pay" Font-Bold="True" Font-Names="Arial"
Font-Size="12px" ForeColor="White"></asp:Label>
</td>
<td align="center" style="width: 100px; background-color: #7FA5D7;">
<asp:Label ID="Label5" runat="server" Text="% Complete" Font-Bold="True" Font-Names="Arial"
Font-Size="12px" ForeColor="White"></asp:Label>
</td>
</tr>
<tr>
<td align="center" style="width: 150px;">
<asp:Label ID="Label1" runat="server" Text="Totals" Font-Bold="True" Font-Names="Arial"
Font-Size="12px"></asp:Label>
</td>
<td align="center" style="width: 100px;">
<asp:Label ID="lblhdrJurisdictions" runat="server" Font-Names="arial,sans-serif"
Font-Size="12px"></asp:Label>
</td>
<td align="center" style="width: 100px;">
<asp:Label ID="lblhdrPrior" runat="server" Font-Names="arial,sans-serif" Font-Size="12px"></asp:Label>
</td>
<td align="center" style="width: 100px;">
<asp:Label ID="lblhdrCurrent" runat="server" Font-Names="arial,sans-serif" Font-Size="12px"></asp:Label>
</td>
<td align="center" style="width: 100px;">
<asp:Label ID="lblhdrItemsLeft" runat="server" Font-Names="arial,sans-serif" Font-Size="12px"></asp:Label>
</td>
<td align="center" style="width: 100px;">
<asp:Label ID="lblhdrPctComplete" runat="server" Font-Names="arial,sans-serif" Font-Size="12px"></asp:Label>
</td>
</tr>
</table>
</div>
<br />
<table>
<tr>
<td>
<asp:Label ID="lblCurrentandPrior" runat="server" Font-Bold="True" Font-Size="Large"
Font-Names="Arial">Current and
Prior Inventory by Assignee
</asp:Label>
</td>
</tr>
</table>
<table>
<tr>
<td colspan="3">
<telerik:RadGrid ID="grdCurrentandPrior" runat="server" AllowSorting="True" AutoGenerateColumns="False"
GridLines="Horizontal" Skin="Web20" Style="margin-right: 0px" Width="780px" Height="255px"
OnNeedDataSource="grdCurrentandPrior_NeedDataSource" OnExcelMLExportRowCreated="grdCurrentandPrior_ExcelMLExportRowCreated">
<ExportSettings FileName="OpenItemsCurrentInventory" IgnorePaging="True" OpenInNewWindow="True"
ExportOnlyData="true" Excel-Format="ExcelML">
</ExportSettings>
<MasterTableView CommandItemDisplay="Bottom" AllowNaturalSort="false" UseAllDataFields="true">
<CommandItemSettings ShowExportToExcelButton="true" ShowAddNewRecordButton="false"
ShowRefreshButton="false" />
<Columns>
<telerik:GridTemplateColumn DataField="Assignee" HeaderText="Assignee" UniqueName="Assignee"
SortExpression="Assignee">
<HeaderStyle Font-Bold="True" Width="150px" HorizontalAlign="Center" Font-Names="Arial" />
<ItemTemplate>
<asp:Label ID="lbAssignee" runat="server" Text='<%# Eval("Assignee") %>'></asp:Label>
</ItemTemplate>
<FooterStyle HorizontalAlign="Right" Font-Bold="true" />
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn DataField="State" HeaderText="State" UniqueName="State"
SortExpression="State" Visible="false">
<HeaderStyle Font-Bold="True" Width="150px" HorizontalAlign="Center" Font-Names="Arial" />
<ItemTemplate>
<asp:Label ID="lbState" runat="server" Text='<%# Eval("State") %>'></asp:Label>
</ItemTemplate>
<FooterStyle HorizontalAlign="Right" Font-Bold="true" />
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn DataField="JurisdictionCount" HeaderText="Jurisdictions"
UniqueName="JurisdictionCount" SortExpression="JurisdictionCount">
<HeaderStyle Font-Bold="True" Width="100px" HorizontalAlign="Center" Font-Names="Arial" />
<ItemTemplate>
<asp:Label ID="lbJurisdiction" runat="server" Text='<%# Eval("JurisdictionCount", "{0:N0}")%>'></asp:Label>
</ItemTemplate>
<ItemStyle HorizontalAlign="Right" ForeColor="Black" />
<FooterStyle HorizontalAlign="Right" Font-Bold="true" />
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn DataField="OpenItemsCountPrior" HeaderText="Prior Open Items"
UniqueName="OpenItemsCountPrior" SortExpression="OpenItemsCountPrior">
<HeaderStyle Font-Bold="True" Width="100px" HorizontalAlign="Center" Font-Names="Arial" />
<ItemTemplate>
<asp:Label ID="lbPrior" runat="server" Text='<%# Eval("OpenItemsCountPrior", "{0:N0}") %>'></asp:Label>
</ItemTemplate>
<ItemStyle HorizontalAlign="Right" ForeColor="Black" />
<FooterStyle HorizontalAlign="Right" Font-Bold="true" />
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn DataField="OpenItemsCountCurrent" HeaderText="Current Open Items"
UniqueName="OpenItemsCountCurrent" SortExpression="OpenItemsCountCurrent">
<HeaderStyle Font-Bold="True" Width="100px" HorizontalAlign="Center" Font-Names="Arial" />
<ItemTemplate>
<asp:Label ID="lbCurrent" runat="server" Text='<%# Eval("OpenItemsCountCurrent", "{0:N0}") %>'></asp:Label>
</ItemTemplate>
<ItemStyle HorizontalAlign="Right" ForeColor="Black" />
<FooterStyle HorizontalAlign="Right" Font-Bold="true" />
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn DataField="TotalRemainingItems" HeaderText="Items Left to Pay"
UniqueName="TotalRemainingItems" SortExpression="TotalRemainingItems">
<HeaderStyle Font-Bold="True" Width="105px" HorizontalAlign="Center" Font-Names="Arial" />
<ItemTemplate>
<asp:Label ID="lblTotalRemain" runat="server" Text='<%# Eval("TotalRemainingItems", "{0:N0}") %>'></asp:Label>
</ItemTemplate>
<ItemStyle HorizontalAlign="Right" ForeColor="Black" />
<FooterStyle HorizontalAlign="Right" Font-Bold="true" />
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn DataField="PercentComplete" HeaderText="% Complete" UniqueName="clmPctComplete"
SortExpression="PercentComplete">
<HeaderStyle Font-Bold="True" HorizontalAlign="Center" Font-Names="Arial" />
<ItemTemplate>
<asp:Label ID="lblPctComplete" runat="server" Text='<%# Eval("PercentComplete", "{0:F2}%")%>'></asp:Label>
</ItemTemplate>
<ItemStyle HorizontalAlign="Right" ForeColor="Black" />
<FooterStyle HorizontalAlign="Right" Font-Bold="true" />
</telerik:GridTemplateColumn>
<telerik:GridBoundColumn DataField="AssigneeEmployeeKey" ReadOnly="True" UniqueName="AssigneeEmployeeKey"
Visible="False">
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
<HeaderStyle BorderStyle="Solid" />
<ClientSettings>
<Scrolling AllowScroll="True" UseStaticHeaders="True" />
</ClientSettings>
</telerik:RadGrid>
</td>
</tr>
</table>
<br />
<table>
<tr>
<td>
<asp:Button ID="btnFutureInventory" runat="server" Text="Future Inventory" SkinID="Web20"
OnClientClick="onFutureInventory(); return false;" Width="164px" UseSubmitBehavior="false" />
</td>
</tr>
</table>
</asp:Panel>
</asp:Panel>
</form>
</
body>
</
html>
.cs File
using
System;
using
System.Collections;
using
System.Collections.Generic;
using
System.Configuration;
using
System.Data;
using
System.Linq;
using
System.Web;
using
System.Web.Security;
using
System.Web.UI;
using
System.Web.UI.HtmlControls;
using
System.Web.UI.WebControls;
using
System.Web.UI.WebControls.WebParts;
using
System.Xml.Linq;
using
Sterling.SNEF.Core;
using
Sterling.SNEF.Tax.Entity;
using
Sterling.SNEF.Tax.Service;
using
Telerik.Web.UI;
using
Telerik.Web.UI.GridExcelBuilder;
namespace
Sterling.SNEF.Tax.Web
{
public partial class OpenItemsInventory : OpenItemsBasePage
{
public OpenItemsInventory()
{ }
protected void Page_Load(object sender, EventArgs e)
{
BaseLogger.LogInfo(System.Reflection.MethodBase.GetCurrentMethod().Name);
RadAjaxManager.GetCurrent(this.Page).AjaxRequest += new RadAjaxControl.AjaxRequestDelegate(RadAjaxManager1_AjaxRequest);
if (!Page.IsPostBack)
{
GetInventoryHeaderData();
GetCurrentandPriorbyAssigneeData();
ViewByGroup_CheckedChanged(rdoAssignee, e);
}
}
protected void ViewByGroup_CheckedChanged(object sender, EventArgs e)
{
try
{
if (rdoAssignee.Checked == true)
{
lblhdrAssignee.Text =
"Assignee";
lblCurrentandPrior.Text =
"Current and Prior Inventory by Assignee";
GetCurrentandPriorbyAssigneeData();
grdCurrentandPrior.MasterTableView.Columns[0].Visible =
true;
grdCurrentandPrior.MasterTableView.Columns[1].Visible =
false;
}
else
{
lblhdrAssignee.Text =
"State";
lblCurrentandPrior.Text =
"Current and Prior Inventory by State";
GetCurrentandPriorbyStateData();
grdCurrentandPrior.MasterTableView.Columns[0].Visible =
false;
grdCurrentandPrior.MasterTableView.Columns[1].Visible =
true;
}
}
catch (Exception ex)
{
BaseLogger.LogError("OpenItemsInventory.ViewByGroup_CheckedChanged Error : " + ex.Message);
throw;
}
}
//Method retrieves Inventory Header Counts and populates the fields.
protected void GetInventoryHeaderData()
{
try
{
BaseLogger.LogInfo(System.Reflection.MethodBase.GetCurrentMethod().Name);
var invSvc = new InventoryService(Convert.ToInt16(base.CurrentEnvironment.OrganizationId));
var invSvcResult = invSvc.GetInventoryHeader(CurrentEnvironment.EmployeeKey);
if (invSvcResult != null)
{
//lblhdrJurisdictions.Text = Convert.ToString(invSvcResult.JurisdictionCount,);
lblhdrJurisdictions.Text = invSvcResult.JurisdictionCount.ToString(
"N0");
lblhdrPrior.Text = invSvcResult.OpenItemsCountPrior.ToString(
"N0");
lblhdrCurrent.Text = invSvcResult.CurrentItems.ToString(
"N0");
lblhdrItemsLeft.Text = invSvcResult.TotalRemainingItems.ToString(
"N0");
lblhdrPctComplete.Text = invSvcResult.PercentComplete.ToString(
"P2");
}
else
BaseLogger.LogWarn("Inventory header is empty.");
}
catch (Exception ex)
{
BaseLogger.LogError("OpenItemsInventory.GetInventoryHeaderData Error : " + ex.Message);
throw;
}
}
public void GetCurrentandPriorbyAssigneeData()
{
try
{
BaseLogger.LogInfo(System.Reflection.MethodBase.GetCurrentMethod().Name);
InventoryService invSvc = new InventoryService(Convert.ToInt16(CurrentEnvironment.OrganizationId));
List<InventorySummary> InventoryResult;
InventoryResult = invSvc.GetInventorySummaryByAssignee(CurrentEnvironment.EmployeeKey);
if (InventoryResult != null && InventoryResult.Count > 0)
{
grdCurrentandPrior.DataSource = InventoryResult;
grdCurrentandPrior.DataBind();
InventorySessionState.CurrentSessionState.InventorySummaryByAssignee = InventoryResult;
}
else
{
BaseLogger.LogWarn("Inventory summary is empty.");
InventorySessionState.CurrentSessionState.InventorySummaryByAssignee = null;
grdCurrentandPrior.DataSource =
new string[] { };
grdCurrentandPrior.Rebind();
}
}
catch (Exception ex)
{
BaseLogger.LogError("OpenItemsInventory.GetCurrentandPriorbyAssigneeData Error : " + ex.Message);
throw;
}
}
public void GetCurrentandPriorbyStateData()
{
try
{
BaseLogger.LogInfo(System.Reflection.MethodBase.GetCurrentMethod().Name);
InventoryService invSvc = new InventoryService(Convert.ToInt16(CurrentEnvironment.OrganizationId));
List<InventorySummary> InventoryResult;
InventoryResult = invSvc.GetInventorySummaryByState(CurrentEnvironment.EmployeeKey);
if (InventoryResult != null && InventoryResult.Count > 0)
{
grdCurrentandPrior.DataSource = InventoryResult;
grdCurrentandPrior.DataBind();
InventorySessionState.CurrentSessionState.InventorySummaryByState = InventoryResult;
}
else
{
InventorySessionState.CurrentSessionState.InventorySummaryByState = null;
grdCurrentandPrior.DataSource =
new string[] { };
grdCurrentandPrior.Rebind();
}
}
catch (Exception ex)
{
BaseLogger.LogError("OpenItemsInventory.GetCurrentandPriorbyStateData Error : " + ex.Message);
throw;
}
}
protected void grdCurrentandPrior_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
BaseLogger.LogInfo(System.Reflection.MethodBase.GetCurrentMethod().Name);
try
{
if (rdoAssignee.Checked == true)
{
if (InventorySessionState.CurrentSessionState.InventorySummaryByAssignee == null)
{
GetCurrentandPriorbyAssigneeData();
}
else
{
grdCurrentandPrior.DataSource =
InventorySessionState.CurrentSessionState.InventorySummaryByAssignee;
}
}
else
{
if (InventorySessionState.CurrentSessionState.InventorySummaryByState == null)
{
GetCurrentandPriorbyStateData();
}
else
{
grdCurrentandPrior.DataSource =
InventorySessionState.CurrentSessionState.InventorySummaryByState;
}
}
}
catch (Exception ex)
{
BaseLogger.LogError("OpenItemsInventory.grdCurrentandPrior_NeedDataSource Error : " + ex.Message);
throw;
}
}
protected void grdCurrentandPrior_ExcelMLExportRowCreated(object source, GridExportExcelMLRowCreatedArgs e)
{
Int32 JurisdictionCount = 0;
Int32 OpenItemsCountPrior = 0;
Int32 OpenItemsCountCurrent = 0;
Int32 TotalRemainingItems = 0;
foreach (GridDataItem item in grdCurrentandPrior.MasterTableView.Items)
{
Label jc = (Label)item.FindControl("lbJurisdiction");
JurisdictionCount +=
Int32.Parse(jc.Text.Replace(",", "").Trim());
Label oipc = (Label)item.FindControl("lbPrior");
OpenItemsCountPrior +=
Int32.Parse(oipc.Text.Replace(",", "").Trim());
Label oicc = (Label)item.FindControl("lbCurrent");
OpenItemsCountCurrent +=
Int32.Parse(oicc.Text.Replace(",", "").Trim());
Label tr = (Label)item.FindControl("lblTotalRemain");
TotalRemainingItems +=
Int32.Parse(tr.Text.Replace(",", "").Trim());
}
if (e.Worksheet.Table.Rows.Count == grdCurrentandPrior.Items.Count + 1)
{
RowElement row = new RowElement();
GridFooterItem footer = (source as RadGrid).MasterTableView.GetItems(GridItemType.Footer)[0] as GridFooterItem;
foreach (GridColumn column in (source as RadGrid).MasterTableView.Columns)
{
CellElement cell = new CellElement();
string cellText = "";
if ((column.UniqueName == "Assignee") && (rdoAssignee.Checked == true))
cellText =
"Totals";
else
{
if ((column.UniqueName == "State") && (rdoState.Checked == true))
cellText =
"Totals";
}
if (column.UniqueName == "JurisdictionCount")
cellText = JurisdictionCount.ToString();
if (column.UniqueName == "OpenItemsCountPrior")
cellText = OpenItemsCountPrior.ToString();
if (column.UniqueName == "OpenItemsCountCurrent")
cellText = OpenItemsCountCurrent.ToString();
if (column.UniqueName == "TotalRemainingItems")
cellText = TotalRemainingItems.ToString();
if (cellText != "")
{
cell.Data.DataItem = cellText ==
" " ? "" : cellText;
row.Cells.Add(cell);
}
}
e.Worksheet.Table.Rows.Add(row);
}
}
protected void RadAjaxManager1_AjaxRequest(object sender, Telerik.Web.UI.AjaxRequestEventArgs e)
{
if (e.Argument == "InitialPageLoad")
{
//simulate longer page load
//System.Threading.Thread.Sleep(2000);
Panel2.Visible =
true;
}
}
}
}
I would really like the LoadingPanel to show on Page Load and then disappear when page had completed loading.
Thanks
Kristi