HI,
I have aggergate problem on one of the column Total_goal of the data source. If remove the aggergate then no exception.
What is the reason for this behaviour? Clearly Total_Goal Column is the part of data source.
<telerik:GridTemplateColumn Aggregate="Sum" DataField="Total_Goal" UniqueName="TotalGoals" ItemStyle-Width="75px" HeaderStyle-Font-Bold="true" FooterAggregateFormatString="{0:F2}" FooterStyle-Font-Bold="true" >
<HeaderTemplate>
Total Goal
</HeaderTemplate>
<ItemTemplate>
<a href="HinoPartsDashBoardTransactions.aspx?SalesType=AM&from= <%#ddlStartMonth.SelectedValue%>&to=<%#ddlEndMonth.SelectedValue%>&DMP= <%#Eval("User_ID")%>"><%#Eval("Total_Goal")%></a>
</ItemTemplate>
</telerik:GridTemplateColumn>
Total_Goal Total_sales
0.00 123.67
0.00 4567.89
Error:
Server Error in '/HinoParts3' Application.
Exception Details: System.IndexOutOfRangeException: Cannot find column -1.
Source Error:
Stack Trace:
I have aggergate problem on one of the column Total_goal of the data source. If remove the aggergate then no exception.
What is the reason for this behaviour? Clearly Total_Goal Column is the part of data source.
<telerik:GridTemplateColumn Aggregate="Sum" DataField="Total_Goal" UniqueName="TotalGoals" ItemStyle-Width="75px" HeaderStyle-Font-Bold="true" FooterAggregateFormatString="{0:F2}" FooterStyle-Font-Bold="true" >
<HeaderTemplate>
Total Goal
</HeaderTemplate>
<ItemTemplate>
<a href="HinoPartsDashBoardTransactions.aspx?SalesType=AM&from= <%#ddlStartMonth.SelectedValue%>&to=<%#ddlEndMonth.SelectedValue%>&DMP= <%#Eval("User_ID")%>"><%#Eval("Total_Goal")%></a>
</ItemTemplate>
</telerik:GridTemplateColumn>
Total_Goal Total_sales
0.00 123.67
0.00 4567.89
Error:
Server Error in '/HinoParts3' Application.
Cannot find column -1.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.Exception Details: System.IndexOutOfRangeException: Cannot find column -1.
Source Error:
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.
|
Stack Trace:
|
4 Answers, 1 is accepted
0
Balkar
Top achievements
Rank 1
answered on 15 May 2013, 07:13 PM
Please answer my question
0
Hello Balkar,
I tried to reproduce the described issue but to no avail. I am sending you a simple example based on your code snippet. Please check it out and let me know what differs in your case.
Looking forward for your reply.
All the best,
Radoslav
the Telerik team
I tried to reproduce the described issue but to no avail. I am sending you a simple example based on your code snippet. Please check it out and let me know what differs in your case.
Looking forward for your reply.
All the best,
Radoslav
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Balkar
Top achievements
Rank 1
answered on 21 May 2013, 09:16 PM
Radoslav ,
Here is my complete code.
rgPartDashboard is Hierachical grid which have master and detail. Both Master and Detail datasource have same number of column.
There is no problem in Detail but master throwing the exception attached in previous post. Any thought.
Here is my complete code.
rgPartDashboard is Hierachical grid which have master and detail. Both Master and Detail datasource have same number of column.
There is no problem in Detail but master throwing the exception attached in previous post. Any thought.
using System;using System.Collections;using System.Collections.Generic;using System.Configuration;using System.Data;using System.Data.OleDb;using System.IO;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 Hino_BL;using Telerik.Web.UI;public partial class Dashboard_HinoPartsDashboard : System.Web.UI.Page{ #region Properties private int _LoggedInUser; private string _LoggedInUserName; private int _SecurityPage; private bool _IsAdmin; public int LoggedInUser { get { return _LoggedInUser; } set { _LoggedInUser = value; } } public string LoggedInUserName { get { return _LoggedInUserName; } set { _LoggedInUserName = value; } } public int SecurityPage { get { return _SecurityPage; } set { _SecurityPage = value; } } public bool IsAdmin { get { return _IsAdmin; } set { _IsAdmin = value; } } #endregion protected void rgPartDashboard_PreRender(object sender, EventArgs e) { if (!Page.IsPostBack) { //rgPartDashboard.MasterTableView.Items[0].Expanded = true; //rgDashboard.MasterTableView.Items[0].ChildItem.FindControl("InnerContainer").Visible = true; } } private void DefineGridStructure() { string FromYearMonth = Request.Form.Get("FromMonthDropDownList"); string ToYearMonth = Request.Form.Get("ToMonthDropDownList"); if (FromYearMonth == null) { FromYearMonth = FromMonthDropDownList.SelectedValue; ToYearMonth = ToMonthDropDownList.SelectedValue; } RadGrid rgPartSalesByVendor = new RadGrid(); rgPartSalesByVendor.AutoGenerateColumns = false; rgPartSalesByVendor.ID = "rgPartSalesByVendor"; rgPartSalesByVendor.GridLines = System.Web.UI.WebControls.GridLines.Both; rgPartSalesByVendor.ShowFooter = true; rgPartSalesByVendor.Skin = "Outlook"; rgPartSalesByVendor.NeedDataSource += new Telerik.Web.UI.GridNeedDataSourceEventHandler(rgPartSalesByVendor_Load); rgPartSalesByVendor.MasterTableView.Caption = "Sales By Vendor"; rgPartSalesByVendor.MasterTableView.CssClass = "MasterClass"; rgPartSalesByVendor.MasterTableView.Columns.Clear(); GridBoundColumn boundColumnVendor = new GridBoundColumn(); boundColumnVendor.DataField = "Vendor"; boundColumnVendor.UniqueName = "Vendor"; boundColumnVendor.HeaderText = "Vendor"; boundColumnVendor.HeaderStyle.Font.Bold = true; boundColumnVendor.FooterStyle.Font.Bold = true; boundColumnVendor.FooterText = "Grand Total:"; boundColumnVendor.ItemStyle.ForeColor = System.Drawing.Color.Blue; rgPartSalesByVendor.MasterTableView.Columns.Add(boundColumnVendor); //Bind sales By vendor Grid SqlDataSource1.SelectParameters["StartMonth"].DefaultValue = FromYearMonth.Substring(4, 2); SqlDataSource1.SelectParameters["StartYear"].DefaultValue = FromYearMonth.Substring(0, 4); //ddlStartYear.SelectedValue; SqlDataSource1.SelectParameters["EndMonth"].DefaultValue = ToYearMonth.Substring(4, 2); // ddlEndMonth.SelectedValue; SqlDataSource1.SelectParameters["EndYear"].DefaultValue = ToYearMonth.Substring(0, 4); //ddlEndYear.SelectedValue; DataTable dt = null; DataView dv = null; dv = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty); if (dv != null) { dt = dv.ToTable(); CreateTemplateColumn(dt, ref rgPartSalesByVendor, FromYearMonth, ToYearMonth); } pnlSalesByVendor.Controls.Add(rgPartSalesByVendor); Session.Add("GridPartSalesByVendor", rgPartSalesByVendor); } protected void Page_Init(object sender, EventArgs e) { if (!IsPostBack) { InitializeMonthDropDownLists(); } DefineGridStructure(); } protected void Page_Load(object sender, EventArgs e) { //get the logged in user //this will work on local dev machine and prod without a change if (Request.Url.AbsoluteUri.ToString().Contains("localhost")) LoggedInUserName = "bbajwa"; //LoggedInUserName = "braddpm"; else LoggedInUserName = Request.Cookies["UserName"].Value.ToString(); //verify that they can access this page. check_Security(); if (!IsPostBack) { try { Hino_BL.HinoCommons getRefresh = new Hino_BL.HinoCommons(); lblLastRefreshDate.Text = "Last Refresh Date: " + Convert.ToDateTime(getRefresh.GetConfigVariableFromDatabase("AS400", "LastDashboardRefreshDate")[0].VariableValue.ToString()); } catch { lblLastRefreshDate.Text = "Last Refresh Date: N/A"; } } RadGrid grid = (RadGrid)pnlSalesByVendor.FindControl("rgPartSalesByVendor"); upd1.ContentTemplateContainer.Controls.RemoveAt(upd1.ContentTemplateContainer.Controls.Count - 1); upd1.ContentTemplateContainer.Controls.Add(pnlSalesByVendor); if (chkVendor.Checked) { pnlSalesParts.Visible = false; pnlSalesByVendor.Visible = true; } if (chkDealer.Checked || (chkDealer.Checked & chkVendor.Checked)) { pnlSalesParts.Visible = true; pnlSalesByVendor.Visible = false; } if (!chkDealer.Checked & !chkVendor.Checked) { pnlSalesParts.Visible = true; pnlSalesByVendor.Visible = false; } } public void InitializeMonthDropDownLists() { Int32 offset = -12; while (offset <= 0) { FromMonthDropDownList.Items.Add(new ListItem(string.Format("{0:MMMM} {0:yyyy}", DateTime.Today.AddMonths(offset)), string.Format("{0:yyyy}{0:MM}", DateTime.Today.AddMonths(offset)))); ToMonthDropDownList.Items.Add(new ListItem(string.Format("{0:MMMM} {0:yyyy}", DateTime.Today.AddMonths(offset)), string.Format("{0:yyyy}{0:MM}", DateTime.Today.AddMonths(offset)))); offset += 1; } try { if (Session["FromMonth"].ToString() != "") { FromMonthDropDownList.Items.FindByValue(Session["FromMonth"].ToString()).Selected = true; } else { FromMonthDropDownList.SelectedIndex = 12; } if (Session["ToMonth"].ToString() != "") { ToMonthDropDownList.Items.FindByValue(Session["ToMonth"].ToString()).Selected = true; } else { ToMonthDropDownList.SelectedIndex = 12; } } catch { FromMonthDropDownList.SelectedIndex = 12; ToMonthDropDownList.SelectedIndex = 12; } } protected void MonthDropDownList_SelectedIndexChanged(object source, EventArgs e) { string FromYearMonth=FromMonthDropDownList.SelectedValue; string ToYearMonth = ToMonthDropDownList.SelectedValue; SqlDataSource3.SelectParameters["StartMonth"].DefaultValue = FromYearMonth.Substring(4, 2); SqlDataSource3.SelectParameters["StartYear"].DefaultValue = FromYearMonth.Substring(0, 4); //ddlStartYear.SelectedValue; SqlDataSource3.SelectParameters["EndMonth"].DefaultValue = ToYearMonth.Substring(4, 2); // ddlEndMonth.SelectedValue; SqlDataSource3.SelectParameters["EndYear"].DefaultValue = ToYearMonth.Substring(0, 4); //ddlEndYear.SelectedValue; rgPartDashboard.DataSource = SqlDataSource3; //Bind sales By vendor Grid SqlDataSource1.SelectParameters["StartMonth"].DefaultValue = FromYearMonth.Substring(4, 2); SqlDataSource1.SelectParameters["StartYear"].DefaultValue = FromYearMonth.Substring(0, 4); //ddlStartYear.SelectedValue; SqlDataSource1.SelectParameters["EndMonth"].DefaultValue = ToYearMonth.Substring(4, 2); // ddlEndMonth.SelectedValue; SqlDataSource1.SelectParameters["EndYear"].DefaultValue = ToYearMonth.Substring(0, 4); //ddlEndYear.SelectedValue; RadGrid grid = (RadGrid)pnlSalesByVendor.FindControl("rgPartSalesByVendor"); grid.DataSource = SqlDataSource1; grid.Rebind(); Session.Add("FromMonth", FromMonthDropDownList.SelectedValue); Session.Add("ToMonth", ToMonthDropDownList.SelectedValue); if (rgPartDashboard.Visible) { rgPartDashboard.Rebind(); } } protected void btnExport_Click(object sender, System.EventArgs e) { RadGrid grid = (RadGrid)pnlSalesByVendor.FindControl("rgPartSalesByVendor"); if (grid.Visible) { grid.MasterTableView.ExportToExcel(); } if (rgPartDashboard.Visible) { ConfigureExport(); rgPartDashboard.MasterTableView.ExportToExcel(); } } public void ConfigureExport() { rgPartDashboard.ExportSettings.ExportOnlyData = chk1.Checked; rgPartDashboard.ExportSettings.IgnorePaging = chk2.Checked; rgPartDashboard.ExportSettings.OpenInNewWindow = chk3.Checked; if (chk4.Checked) { rgPartDashboard.ExportSettings.IgnorePaging = false; foreach (Telerik.Web.UI.GridDataItem item in rgPartDashboard.MasterTableView.Items) { item.Expanded = true; foreach (Telerik.Web.UI.GridDataItem nestedItem in item.ChildItem.NestedTableViews[0].Items) { nestedItem.Expanded = true; //foreach (Telerik.Web.UI.GridDataItem nestedItem1 in nestedItem.ChildItem.NestedTableViews[0].Items) //{ // nestedItem1.Expanded = true; //} } } } } protected void rgPartDashboard_Load(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e) { if (!e.IsFromDetailTable) { string FromYearMonth = FromMonthDropDownList.SelectedValue; string ToYearMonth = ToMonthDropDownList.SelectedValue; SqlDataSource3.SelectParameters["StartMonth"].DefaultValue = FromYearMonth.Substring(4, 2); SqlDataSource3.SelectParameters["StartYear"].DefaultValue = FromYearMonth.Substring(0, 4); SqlDataSource3.SelectParameters["EndMonth"].DefaultValue = ToYearMonth.Substring(4, 2); SqlDataSource3.SelectParameters["EndYear"].DefaultValue = ToYearMonth.Substring(0, 4); rgPartDashboard.DataSource = SqlDataSource3; } } protected void rgPartDashboard_Detail(object source, Telerik.Web.UI.GridDetailTableDataBindEventArgs e) { string FromYearMonth = FromMonthDropDownList.SelectedValue; string ToYearMonth = ToMonthDropDownList.SelectedValue; Telerik.Web.UI.GridDataItem dataItem = (Telerik.Web.UI.GridDataItem)e.DetailTableView.ParentItem; SqlDataSource2.SelectParameters["userid"].DefaultValue = dataItem.GetDataKeyValue("user_id").ToString(); SqlDataSource2.SelectParameters["StartMonth"].DefaultValue = FromYearMonth.Substring(4, 2); SqlDataSource2.SelectParameters["StartYear"].DefaultValue = FromYearMonth.Substring(0, 4); SqlDataSource2.SelectParameters["EndMonth"].DefaultValue = ToYearMonth.Substring(4, 2); SqlDataSource2.SelectParameters["EndYear"].DefaultValue = ToYearMonth.Substring(0, 4); (source as Telerik.Web.UI.RadGrid).DataSource = SqlDataSource2; } protected void rgPartSalesByVendor_Load(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e) { if (!e.IsFromDetailTable) { string FromYearMonth = FromMonthDropDownList.SelectedValue; string ToYearMonth = ToMonthDropDownList.SelectedValue; SqlDataSource1.SelectParameters["StartMonth"].DefaultValue = FromYearMonth.Substring(4, 2); SqlDataSource1.SelectParameters["StartYear"].DefaultValue = FromYearMonth.Substring(0, 4); SqlDataSource1.SelectParameters["EndMonth"].DefaultValue = ToYearMonth.Substring(4, 2); SqlDataSource1.SelectParameters["EndYear"].DefaultValue = ToYearMonth.Substring(0, 4); (source as Telerik.Web.UI.RadGrid).DataSource = SqlDataSource1; } } #region Create GridTemplate column private void CreateTemplateColumn(DataTable dt, ref RadGrid rg, string FromYearMonth, string ToYearMonth) { foreach (DataColumn dc in dt.Columns) { if (dc.ColumnName == "Vendor" || dc.ColumnName == "vendorID") continue; if (dc.ColumnName != "Vendor" && dc.ColumnName != "VendorID") { string ColName = dc.ColumnName; string[] DPMNameAndID = ColName.Split(';'); string DPMName = DPMNameAndID[0]; string DMPId = DPMNameAndID[1]; GridTemplateColumn templateColumn = new GridTemplateColumn(); templateColumn.ItemTemplate = new MyTemplate(ColName, FromYearMonth, ToYearMonth, DPMName, DMPId); templateColumn.SortExpression = ColName; templateColumn.HeaderText = DPMName; templateColumn.HeaderStyle.Font.Bold = true; templateColumn.FooterStyle.Font.Bold = true; templateColumn.FooterAggregateFormatString = "{0:F2}"; templateColumn.DataField = ColName; templateColumn.Aggregate = Telerik.Web.UI.GridAggregateFunction.Sum; rg.MasterTableView.Columns.Add(templateColumn); } } } private class MyTemplate : ITemplate { protected HyperLink SealeByVendorTrans; private string colname; private string _fromDate; private string _toDate; private string _DPMName; private string _DPMId; public MyTemplate(string cName,string fromDate,string toDate,string DPMName,string DPMId) { colname = cName; _fromDate = fromDate; _toDate = toDate; _DPMName = DPMName; _DPMId = DPMId; } public void InstantiateIn(System.Web.UI.Control container) { SealeByVendorTrans = new HyperLink(); SealeByVendorTrans.ID = colname; SealeByVendorTrans.DataBinding += new EventHandler(SealeByVendorTrans_DataBinding); container.Controls.Add(SealeByVendorTrans); } void SealeByVendorTrans_DataBinding(object sender, EventArgs e) { HyperLink link = (HyperLink)sender; GridDataItem container = (GridDataItem)link.NamingContainer; link.Text = ((DataRowView)container.DataItem)[colname].ToString(); link.NavigateUrl = "HinoPartsDashBoardTransactions.aspx?type=Vendor&TransType=V&DPMName=" + _DPMName + "&DPM=" + _DPMId + "&from=" + _fromDate + "&to=" + _toDate + "&VendorID=" + ((DataRowView)container.DataItem)["VendorID"].ToString() + "&Vendor=" + ((DataRowView)container.DataItem)["Vendor"].ToString(); } } #endregion #region Security public void check_Security() { Boolean HasAccess = false; IsAdmin = false; Hino_BL.UserSecurity userSec = new Hino_BL.UserSecurity(); userSec.UserName = LoggedInUserName; try { UserSecurity userInfo = userSec.GetUserByUserName()[0]; LoggedInUser = userInfo.User_id; } catch { LoggedInUser = 0; } userSec.SecurityPageName = "Dashboard"; foreach (UserSecurity list in userSec.GetSecurityPageByName()) { SecurityPage = list.SecurityPage_id; } userSec.SecurityPage_id = _SecurityPage; userSec.User_id = _LoggedInUser; foreach (UserSecurity list in userSec.GetSecurityFunctionsByUser_idandSecurityPage_id()) { HasAccess = true; } //if they don't have access take them to the access denied page. if (!HasAccess) { Response.Redirect("../AccessDenied.aspx"); } } #endregion}<%@ Page Language="C#" MaintainScrollPositionOnPostback="true" AutoEventWireup="true" EnableEventValidation="false" CodeFile="HinoPartsDashboard.aspx.cs" Inherits="Dashboard_HinoPartsDashboard" %><%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %><%@ Register TagPrefix="HinoDataControl" TagName="HinoDataSelect" Src="~/Components/HinoDataSelect.ascx" %><!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>Hino Dashboard</title> <link rel="stylesheet" type="text/css" href="../Includes/StyleSheets/Dashboard.css" /></head><body> <form id="form1" runat="server"> <asp:ScriptManager ID="script1" runat="server" ScriptMode="Release"></asp:ScriptManager> <div class="pageheader"> <h1>Dashboard</h1> <p> <asp:Label ID="lblLastRefreshDate" Font-Size="11px" runat="Server" Text="Last Refresh Date:"></asp:Label> <br /> <a href="HinoDashboard_Main.aspx" id="backButton" runat="server">Dashboard Home</a> </p> <a></a> </div> <asp:UpdatePanel ID="upd1" runat="server"> <Triggers> <asp:PostBackTrigger ControlID="btnExport" /> </Triggers> <ContentTemplate> <div class="filters"> <fieldset> <legend>Filters</legend> <dl> <dt>From Month/Year</dt> <dl> <dt>From Month</dt> <dd><asp:DropDownList ID="FromMonthDropDownList" runat="server" AutoPostBack="True" OnSelectedIndexChanged="MonthDropDownList_SelectedIndexChanged" /></dd> <dt>To Month</dt> <dd><asp:DropDownList ID="ToMonthDropDownList" runat="server" AutoPostBack="True" OnSelectedIndexChanged="MonthDropDownList_SelectedIndexChanged"/></dd> <dd class="break"></dd> <dd style="margin-left:0px"><asp:CheckBox ID="chkDealer" runat="server" Text="Display By Dealers" AutoPostBack="true" Checked="true"/></dd> <dd style="margin-left:0px"><asp:CheckBox ID="chkVendor" runat="server" Text="Display By Vendors" AutoPostBack="true" /></dd> </dl> </fieldset> <fieldset> <legend>Export Options</legend> <dl> <dd style="margin-left:0px"><asp:CheckBox ID="chk1" Text="Export only data" runat="server"></asp:CheckBox></dd> <dd style="margin-left:0px"><asp:CheckBox ID="chk4" Text="Expand Grid" runat="server" /></dd> <dd style="margin-left:0px"><asp:CheckBox ID="chk2" Text="Export all Pages" runat="server"></asp:CheckBox></dd> <dd style="margin-left:0px"><asp:CheckBox ID="chk3" Text="Open in new window" runat="server"></asp:CheckBox></dd> <dd style="margin-left:0px"><asp:Button ID="btnExport" Text="Export" OnClick="btnExport_Click" runat="server"></asp:Button></dd> </dl> </fieldset> </div> <div class="data" style="width:60%; top: 0px; left: 0px;"> <input type="hidden" runat="server" name="dist" value="" id="dist" /> <asp:Panel ID="pnlSalesParts" runat="server" Width="100%" Visible="true"> <telerik:RadGrid runat="server" ID="rgPartDashboard" ShowFooter="true" AllowFilteringByColumn="false" AutoGenerateColumns="false" HorizontalAlign="Left" AllowSorting="false" EnableLinqExpressions="false" PageSize="10" Width="100%" ShowGroupPanel="false" OnNeedDataSource="rgPartDashboard_Load" OnDetailTableDataBind="rgPartDashboard_Detail" ShowStatusBar="true" Skin="Outlook" AllowPaging="false" GridLines="Both" OnPreRender="rgPartDashboard_PreRender"> <ClientSettings EnableRowHoverStyle="true"> </ClientSettings> <MasterTableView DataKeyNames="user_id" AllowMultiColumnSorting="True" HorizontalAlign="Right" Width="100%" ShowFooter="true" CssClass="MasterClass" Caption="Sales 02 Parts"> <DetailTables> <telerik:GridTableView Name="Dealers" AutoGenerateColumns="false" DataKeyNames="dealer_id" AllowFilteringByColumn="false" AllowSorting="false" AllowPaging="false" Width="100%" ShowFooter="true" ShowHeader="false" DataSourceID="SqlDataSource2" HorizontalAlign="Right" CssClass="DetailClass"> <Columns> <telerik:GridBoundColumn SortExpression="DealerName" HeaderText="DealerName" DataField="Dealer_Name" UniqueName="Dealer_Name" ItemStyle-Width="220px" > </telerik:GridBoundColumn> <telerik:GridTemplateColumn Aggregate="Sum" DataField="HO_sales" UniqueName="HO_sales" ItemStyle-Width="70px" HeaderStyle-Font-Bold="true" FooterAggregateFormatString="{0:F2}" FooterStyle-Font-Bold="true" > <HeaderTemplate> HO Sales </HeaderTemplate> <ItemTemplate> <a href="HinoPartsDashBoardTransactions.aspx?TransType=S&type=Dealer&SalesType=HO&_name=<%#Eval("Dealer_Name")%>&DPM=<%#Eval("User_ID")%>&from=<%#FromMonthDropDownList.SelectedValue%>&to=<%#ToMonthDropDownList.SelectedValue%>&DealerID=<%#Eval("Dealer_ID")%>"><%#Eval("HO_sales")%></a> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn Aggregate="Sum" DataField="HO_Goal" UniqueName="HO_Goal" ItemStyle-Width="70px" HeaderStyle-Font-Bold="true" FooterAggregateFormatString="{0:F2}" FooterStyle-Font-Bold="true" > <HeaderTemplate> HO_Goal </HeaderTemplate> <ItemTemplate> <a href="HinoPartsDashBoardTransactions.aspx?TransType=G&type=Dealer&SalesType=HO&_name=<%#Eval("Dealer_Name")%>&DPM=<%#Eval("User_ID")%>&from=<%#FromMonthDropDownList.SelectedValue%>&to=<%#ToMonthDropDownList.SelectedValue%>&DealerId=<%#Eval("Dealer_ID")%>"><%#Eval("HO_Goal")%></a> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridCalculatedColumn HeaderText="HO sales Effectiveness" UniqueName="HOSalesEffectiveness" DataType="System.Double" DataFields="HO_Sales, HO_Goal" Expression="iif({0}=null or {0}=0.00 or {1}=null or {1}=0.00,0.00,({0}/{1})*100)" ItemStyle-Width="95px" DataFormatString="{0:F2}%" /> <telerik:GridTemplateColumn Aggregate="Sum" DataField="AM_Sales" UniqueName="AM_Sales" ItemStyle-Width="70px" HeaderStyle-Font-Bold="true" FooterAggregateFormatString="{0:F2}" FooterStyle-Font-Bold="true" > <HeaderTemplate> AM sales </HeaderTemplate> <ItemTemplate> <a href="HinoPartsDashBoardTransactions.aspx?TransType=S&type=Dealer&SalesType=AM&_name=<%#Eval("Dealer_Name")%>&DPM=<%#Eval("User_ID")%>&from=<%#FromMonthDropDownList.SelectedValue%>&to=<%#ToMonthDropDownList.SelectedValue%>&DealerId=<%#Eval("Dealer_ID")%>"><%#Eval("AM_Sales")%></a> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn Aggregate="Sum" DataField="AM_GOAL" UniqueName="AM_GOAL" ItemStyle-Width="70px" HeaderStyle-Font-Bold="true" FooterAggregateFormatString="{0:F2}" FooterStyle-Font-Bold="true" > <HeaderTemplate> AM Goal </HeaderTemplate> <ItemTemplate> <a href="HinoPartsDashBoardTransactions.aspx?TransType=G&type=Dealer&SalesType=AM&_name=<%#Eval("Dealer_Name")%>&DPM=<%#Eval("User_ID")%>&from=<%#FromMonthDropDownList.SelectedValue%>&to=<%#ToMonthDropDownList.SelectedValue%>&DealerId=<%#Eval("Dealer_ID")%>"><%#Eval("AM_GOAL")%></a> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridCalculatedColumn HeaderText="AM Sales Effectiveness" UniqueName="AMEffectiveness" DataType="System.Double" DataFields="AM_Sales, AM_Goal" Expression="iif({0}=null or {0}=0.00 or {1}=null or {1}=0.00,0.00,({0}/{1})*100)" ItemStyle-Width="90px" DataFormatString="{0:F2}%" /> <telerik:GridTemplateColumn Aggregate="Sum" DataField="Total_Sales" UniqueName="Total_Sales" ItemStyle-Width="70px" HeaderStyle-Font-Bold="true" FooterAggregateFormatString="{0:F2}" FooterStyle-Font-Bold="true" > <HeaderTemplate> Total Sales </HeaderTemplate> <ItemTemplate> <a href="HinoPartsDashBoardTransactions.aspx?TransType=S&type=Dealer&SalesType=T&_name=<%#Eval("Dealer_Name")%>&DPM=<%#Eval("User_ID")%>&from=<%#FromMonthDropDownList.SelectedValue%>&to=<%#ToMonthDropDownList.SelectedValue%>&DealerId=<%#Eval("Dealer_ID")%>"><%#Eval("Total_Sales")%></a> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn Aggregate="Sum" DataField="Total_Goal" UniqueName="Total_Goal" ItemStyle-Width="70px" HeaderStyle-Font-Bold="true" FooterAggregateFormatString="{0:F2}" FooterStyle-Font-Bold="true" > <HeaderTemplate> Total Goal </HeaderTemplate> <ItemTemplate> <a href="HinoPartsDashBoardTransactions.aspx?TransType=G&type=Dealer&SalesType=T&_name=<%#Eval("Dealer_Name")%>&DPM=<%#Eval("User_ID")%>&from=<%#FromMonthDropDownList.SelectedValue%>&to=<%#ToMonthDropDownList.SelectedValue%>&DealerId=<%#Eval("Dealer_ID")%>"><%#Eval("Total_Goal")%></a> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridCalculatedColumn HeaderText="Total Sales Effectiveness" UniqueName="TotalEffectiveness" DataType="System.Double" DataFields="Total_Sales,Total_goal" Expression="iif({0}=null or {0}=0.00 or {1}=null or {1}=0.00,0.00,({0}/{1})*100)" ItemStyle-Width="90px" DataFormatString="{0:F2}%</a>" /> </Columns> </telerik:GridTableView> </DetailTables> <Columns> <telerik:GridBoundColumn SortExpression="DPM_Name" HeaderText="DPM" DataField="DPM_Name" HeaderStyle-Font-Bold="true" UniqueName="DPM_Name" ItemStyle-Width="250px" FooterText="Grand Total:" FooterStyle-Font-Bold="true" ItemStyle-Font-Bold="true" ItemStyle-Font-Size="Medium" ItemStyle-ForeColor="Blue" ItemStyle-BackColor="Beige"> </telerik:GridBoundColumn> <telerik:GridTemplateColumn Aggregate="Sum" DataField="HO_sales" UniqueName="HO_sales" ItemStyle-Width="75px" HeaderStyle-Font-Bold="true" FooterAggregateFormatString="{0:F2}" FooterStyle-Font-Bold="true" > <HeaderTemplate> HO Sales </HeaderTemplate> <ItemTemplate> <a href="HinoPartsDashBoardTransactions.aspx?TransType=S&type=DPM&SalesType=HO&_name=<%#Eval("DPM_Name")%>&from=<%#FromMonthDropDownList.SelectedValue%>&to=<%#ToMonthDropDownList.SelectedValue%>&DPM=<%#Eval("User_ID")%>"><%#Eval("HO_sales")%></a> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn Aggregate="Sum" DataField="HO_Goal" UniqueName="HO_Goal" ItemStyle-Width="75px" HeaderStyle-Font-Bold="true" FooterAggregateFormatString="{0:F2}" FooterStyle-Font-Bold="true" > <HeaderTemplate> HO Goal </HeaderTemplate> <ItemTemplate> <a href="HinoPartsDashBoardTransactions.aspx?TransType=G&type=DPM&SalesType=HO&_name=<%#Eval("DPM_Name")%>&from=<%#FromMonthDropDownList.SelectedValue%>&to=<%#ToMonthDropDownList.SelectedValue%>&DPM=<%#Eval("User_ID")%>"><%#Eval("HO_Goal")%></a> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridCalculatedColumn Aggregate="Sum" ItemStyle-Width="100px" HeaderText="HO Sales Effectiveness" UniqueName="HoSalesEffectiveness" HeaderStyle-Font-Bold="true" FooterAggregateFormatString="{0:F2}" FooterStyle-Font-Bold="true" DataType="System.Double" DataFields="HO_Sales, HO_Goal" Expression="iif({0}=null or {0}=0.00 or {1}=null or {1}=0.00,0.00,({0}/{1})*100)" DataFormatString="{0:F2}%" > </telerik:GridCalculatedColumn> <telerik:GridTemplateColumn Aggregate="Sum" DataField="AM_sales" UniqueName="AM_sales" ItemStyle-Width="75px" HeaderStyle-Font-Bold="true" FooterAggregateFormatString="{0:F2}" FooterStyle-Font-Bold="true" > <HeaderTemplate> AM Sales </HeaderTemplate> <ItemTemplate> <a href="HinoPartsDashBoardTransactions.aspx?TransType=S&type=DPM&SalesType=AM&_name=<%#Eval("DPM_Name")%>&from=<%#FromMonthDropDownList.SelectedValue%>&to=<%#ToMonthDropDownList.SelectedValue%>&DPM=<%#Eval("User_ID")%>"><%#Eval("AM_sales")%></a> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn Aggregate="Sum" DataField="AM_GOAL" UniqueName="AM_GOAL" ItemStyle-Width="75px" HeaderStyle-Font-Bold="true" FooterAggregateFormatString="{0:F2}" FooterStyle-Font-Bold="true" > <HeaderTemplate> AM Goal </HeaderTemplate> <ItemTemplate> <a href="HinoPartsDashBoardTransactions.aspx?TransType=G&type=DPM&SalesType=AM&_name=<%#Eval("DPM_Name")%>&from=<%#FromMonthDropDownList.SelectedValue%>&to=<%#ToMonthDropDownList.SelectedValue%>&DPM=<%#Eval("User_ID")%>"><%#Eval("AM_GOAL")%></a> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridCalculatedColumn ItemStyle-Width="100px" HeaderText="AM Sales Effectiveness" UniqueName="AMEffectiveness" HeaderStyle-Font-Bold="true" DataType="System.Double" DataFields="AM_Sales, AM_Goal" Expression="iif({0}=null or {0}=0.00 or {1}=null or {1}=0.00,0.00,({0}/{1})*100)" DataFormatString="{0:F2}%" FooterAggregateFormatString="{0:F2}%" Aggregate="Avg" FooterStyle-Font-Bold="true"/> <telerik:GridTemplateColumn Aggregate="Sum" DataField="Total_sales" UniqueName="Total_sales" ItemStyle-Width="75px" HeaderStyle-Font-Bold="true" FooterAggregateFormatString="{0:F2}" FooterStyle-Font-Bold="true" > <HeaderTemplate> Total sales </HeaderTemplate> <ItemTemplate> <a href="HinoPartsDashBoardTransactions.aspx?TransType=S&type=DPM&SalesType=T&_name=<%#Eval("DPM_Name")%>&from=<%#FromMonthDropDownList.SelectedValue%>&to=<%#ToMonthDropDownList.SelectedValue%>&DPM=<%#Eval("User_ID")%>"><%#Eval("Total_sales")%></a> </ItemTemplate> </telerik:GridTemplateColumn> <%-- <telerik:GridTemplateColumn DataField="Total_Goal" DataType="System.Decimal" ItemStyle-Width="75px" HeaderStyle-Font-Bold="true" FooterAggregateFormatString="{0:F2}" FooterStyle-Font-Bold="true" > <HeaderTemplate> Total Goal </HeaderTemplate> <ItemTemplate> <a href="HinoPartsDashBoardTransactions.aspx?SalesType=AM&from=<%#FromMonthDropDownList.SelectedValue%>&to=<%#ToMonthDropDownList.SelectedValue%>&DMP=<%#Eval("User_ID")%>"> <%#Eval("Total_Goal")%></a> </ItemTemplate> </telerik:GridTemplateColumn>--%> <%-- <telerik:GridCalculatedColumn HeaderText="Total Goal" UniqueName="TotalGoal" DataType="System.Double" HeaderStyle-Font-Bold="true" DataFields="HO_Goal, AM_Goal" Expression="{0}+{1}" ItemStyle-Width="75px" Aggregate="Sum" FooterAggregateFormatString="{0:F2}" FooterStyle-Font-Bold="true" DataFormatString="<a href='HinoDashboard_Manage.aspx?desctype=R&type=district'>{0:F2}</a>"> </telerik:GridCalculatedColumn>--%> <telerik:GridTemplateColumn Aggregate="Sum" DataType="System.Decimal" DataField="Total_Goal" UniqueName="TotalGoals" ItemStyle-Width="75px" HeaderStyle-Font-Bold="true" FooterAggregateFormatString="{0:F2}" FooterStyle-Font-Bold="true" > <HeaderTemplate> Total Goal </HeaderTemplate> <ItemTemplate> <a href="HinoPartsDashBoardTransactions.aspx?TransType=G&type=DPM&SalesType=T&_name=<%#Eval("DPM_Name")%>&from=<%#FromMonthDropDownList.SelectedValue%>&to=<%#ToMonthDropDownList.SelectedValue%>&DMP=<%#Eval("User_ID")%>"><%#Eval("Total_Goal")%></a> </ItemTemplate> </telerik:GridTemplateColumn> <%--<telerik:GridCalculatedColumn ItemStyle-Width="100px" HeaderText="Total Sales Effectiveness" HeaderStyle-Font-Bold="true" UniqueName="TotalEffectivenessabc" DataType="System.Double" DataFields="Total_sales,Total_Goal" Expression="iif({0}=null or {0}=0.00 or {1}=0.00,0.00,({0}/{1})*100)" DataFormatString="{0:F2}%" />--%> </Columns> </MasterTableView> </telerik:RadGrid> </asp:Panel> <asp:SqlDataSource ID="SqlDataSource3" ConnectionString="<%$ ConnectionStrings:HinoConnectionString %>" ProviderName="System.Data.SqlClient" SelectCommandType="StoredProcedure" SelectCommand="spSelectPartsDashboardSalesByDPM_ForDateRange" runat="server"> <SelectParameters> <asp:SessionParameter Name="StartMonth" SessionField="StartMonth" Type="Int32" DefaultValue="01" /> <asp:SessionParameter Name="StartYear" SessionField="StartYear" Type="Int32" DefaultValue="2012" /> <asp:SessionParameter Name="EndMonth" SessionField="EndMonth" Type="Int32" DefaultValue="01" /> <asp:SessionParameter Name="EndYear" SessionField="EndYear" Type="Int32" DefaultValue="2013" /> </SelectParameters> </asp:SqlDataSource> <asp:SqlDataSource ID="SqlDataSource2" ConnectionString="<%$ ConnectionStrings:HinoConnectionString %>" ProviderName="System.Data.SqlClient" SelectCommandType="StoredProcedure" SelectCommand="spSelectPartsDashboardSalesByOneDPM_ForDateRange" runat="server"> <SelectParameters> <asp:SessionParameter Name="Userid" SessionField="Userid" Type="Int32" DefaultValue="2568" /> <asp:SessionParameter Name="StartMonth" SessionField="StartMonth" Type="Int32" DefaultValue="01" /> <asp:SessionParameter Name="StartYear" SessionField="StartYear" Type="Int32" DefaultValue="2012" /> <asp:SessionParameter Name="EndMonth" SessionField="EndMonth" Type="Int32" DefaultValue="01" /> <asp:SessionParameter Name="EndYear" SessionField="EndYear" Type="Int32" DefaultValue="2013" /> </SelectParameters> </asp:SqlDataSource> <asp:Panel ID="pnlSalesByVendor" runat="server" Width="100%" Visible="false"> </asp:Panel> <asp:SqlDataSource ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:HinoConnectionString %>" ProviderName="System.Data.SqlClient" SelectCommandType="StoredProcedure" SelectCommand="spSelectPartsDashboardSalesByVendor_ForDateRange" runat="server"> <SelectParameters> <asp:SessionParameter Name="StartMonth" SessionField="StartMonth" Type="Int32" DefaultValue="01" /> <asp:SessionParameter Name="StartYear" SessionField="StartYear" Type="Int32" DefaultValue="2012" /> <asp:SessionParameter Name="EndMonth" SessionField="EndMonth" Type="Int32" DefaultValue="05" /> <asp:SessionParameter Name="EndYear" SessionField="EndYear" Type="Int32" DefaultValue="2013" /> </SelectParameters> </asp:SqlDataSource> </div> </ContentTemplate> </asp:UpdatePanel> <asp:UpdateProgress ID="UpdateProgress1" runat="server" DisplayAfter="1"> <ProgressTemplate> <div class="updatemessage"> <h3>Updating <img src="../Images/circle.gif" alt="" /></h3> </div> </ProgressTemplate> </asp:UpdateProgress> </form></body></html>0
Balkar
Top achievements
Rank 1
answered on 23 May 2013, 05:52 PM
resolved
