Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
212 views
I am defining a RadGrid in a user control with the following definition in the .ascx:

<telerik:RadGrid ID="grid1" OnNeedDataSource="grid1DS" PageSize="20" AllowPaging="True" AutoGenerateColumns="False"
    AllowSorting="True" CellSpacing="-1" GridLines="Both" Style="text-align: left;" OnSelectedIndexChanged="grid1_SelectedIndexChanged"
    AllowFilteringByColumn="True" EnableViewState="true" runat="server">
    <MasterTableView EnableColumnsViewState="true"></MasterTableView>
    <PagerStyle Mode="NextPrevAndNumeric" HorizontalAlign="Left" />
    <ClientSettings EnableRowHoverStyle="true" EnablePostBackOnRowClick="true">
        <Resizing AllowColumnResize="True" AllowRowResize="false" ResizeGridOnColumnResize="true"
            ClipCellContentOnResize="false" EnableRealTimeResize="true" AllowResizeToFit="true" />
        <Selecting AllowRowSelect="True" />
    </ClientSettings>
</telerik:RadGrid>

I am dynamically creating and adding each column with this:

Dim dscol As DataColumn
Dim col As Telerik.Web.UI.GridBoundColumn

...

col =
New GridBoundColumn()
col.DataField = dscol.ColumnName
col.UniqueName = dscol.ColumnName
col.HeaderText = dscol.ColumnName
col.Resizable = True
col.SortExpression = col.DataField
col.AllowFiltering = True
grid1.Columns.Add(col)

This creates a mostly working grid. The problem is that on the call to the grid1DS data source, a filter expression is returned with an empty expression for the DataField value (e.g. filtering on a name field for "Contains" John):

(it[""].ToString().Contains("John"))

Normally, it[""] would be it["DataField identifier"].  So apparently the DataField isn't being properly set in the browser, despite being properly defined in the code above (confirmed by breakpoints.) 

So - thoughts, solutions? 




Konstantin Dikov
Telerik team
 answered on 08 Oct 2014
3 answers
346 views
I have a RadGrid with Filters.  The user can browse to another page (details page) from the page with the RadGrid.  When the user returns I restore the filters to their state when the user browsed away.  This is done via Session data.

The search criteria is restored along with the filter values.  The data is read from the datbase and all is well except that the FILTERs were not honored.In other words, all records are displayed that meet the search criteria, but the filters are not applied.

I think I need to cause a filter event to fire, as if the user had clicked the filter ICON.  How do I cause this to happen?

Thanks for your help.


Konstantin Dikov
Telerik team
 answered on 08 Oct 2014
2 answers
126 views
Hi,
 Simple question - can you tell me if the Telerik ASP.Net Editor is available in SharePoint online? I've grown used to it in our on premise MOSS environment and love it, but we're moving to new technology and nothing is returning on an App Store search for 'Telerik'
Thanks,
Jason.
Jason Brownhill
Top achievements
Rank 1
 answered on 08 Oct 2014
5 answers
544 views
I have a RadGrid that I would like to change the size of the page and the current page number depending on the URL.

I can query the URL and retrieve the data that I would like, and attempt to apply it like so:

Dim pageSize As Integer = 10
Dim pageNum As Integer = 0
If Request.QueryString("PageSize") IsNot Nothing Then
    pageSize = Request.QueryString("PageSize")
    rgvListObservations.PageSize = pageSize
    rgvListObservations.Rebind()
End If
If Request.QueryString("PageNum") IsNot Nothing Then
    pageNum = Request.QueryString("PageNum")
    rgvListObservations.CurrentPageIndex = pageNum
    rgvListObservations.Rebind()
End If


I do this in the Page.PreRender. The CurrentPageIndex will save correctly, but unfortunately the PageSize does not change.

I have attempted to paste this code into the function I call to fill the grid as well as the NeedDataSource(of course removing the rebind call) to no avail.

I am just wondering why one would save but not the other? Also I would like to know if I am attempting to change the PageSize in the backend correctly.
Konstantin Dikov
Telerik team
 answered on 08 Oct 2014
8 answers
148 views
As far as I can tell, newer versions of WebAPI return ISO8601 dates instead of the traditional Microsoft format that was /Date(  )/.

The rendering script has the value of "g" being null when attempting to parse the date and the appointments never bind and the Scheduler breaks with the exception shown in the Locals list in my screenshot. I would hate to have to revert back to using the old format.

Any work around for this?
Boyan Dimitrov
Telerik team
 answered on 08 Oct 2014
3 answers
156 views
I am having a similar problem, and I generated a short example to illustrate the problem. We are using a timer, but it happens to be a bit longer in cycle than the one supplied here. It just takes longer to run out of memory if the timer is longer. Note that the more items that are added to the chart, the larger the memory leak.

I also took the liberty of looking through the Telerik source code and discovered that RadChart contains 2 Chart objects, one directly, and one indirectly through MapAreaBuilder. RadChart does not implement Dispose, so these items hang around much longer than they should. MapAreaBuilder also does not implement dispose, and it should as well. The basic idea is that if a class includes an object that implements IDisposable, the containing class must also implement IDisposable and dispose of the Disposable objects it contains. Yes, RadChart does inherit from Control that implements IDispose, but Control does not know to dispose of the 2 Charts that are contained in the RadChart object. In other words, RadChart needs to override Dispose(bool) and dispose of the Chart and the MapAreaBuilder if the parameter passed in is true. MapAreaBuilder needs to derive from IDisposable, implement Dispose(), Dispose(bool) and ~MapAreaBuilder().

Default.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
namespace RadChartLeakTest
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Timer1Tick(object sender, EventArgs e)
{
}
}
}

Default.aspx
<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
CodeBehind="Default.aspx.cs" Inherits="RadChartLeakTest._Default" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
</telerik:RadScriptManager>
<telerik:RadScriptBlock ID="Script1" runat="server">
<script type="text/javascript">
</script>
</telerik:RadScriptBlock>
<asp:Panel ID="PanelUpdateThis" runat="server">
<telerik:RadChart runat="server" ID="Chart1" >
<Appearance Border-Visible="false" FillStyle-FillType="Solid" FillStyle-MainColor="#f2f2f2">
</Appearance>
<ChartTitle Visible="false">
</ChartTitle>
<Legend Appearance-Border-Visible="false" Appearance-FillStyle-FillType="Solid" Appearance-FillStyle-MainColor="#f2f2f2">
</Legend>
<PlotArea Appearance-Border-Color="#f2f2f2" Appearance-FillStyle-MainColor="#f2f2f2"
Appearance-FillStyle-FillType="Solid" EmptySeriesMessage-TextBlock-Text="No Sessions Last 24 Hours"
EmptySeriesMessage-TextBlock-Appearance-TextProperties-Color="Black">
<XAxis AutoScale="false" IsZeroBased="true">
</XAxis>
</PlotArea>
<Series>
</Series>
</telerik:RadChart>
<asp:Timer ID="Timer1" runat="server" Interval="1000" OnTick="Timer1Tick">
</asp:Timer>
</asp:Panel>
</asp:Content>


Danail Vasilev
Telerik team
 answered on 08 Oct 2014
6 answers
370 views
I have a dynamic grid which is created in page_init. The column of the grid are dynamic. Each times when i pick the new dates some blank column are added to dynamic grid. Please see attached fille.



Aspx file:
<%@ 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">
<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">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Height="75px"
        Width="75px">
        <asp:Image ID="Image1" runat="server" AlternateText="Loading..." ImageUrl="../Images/circle.gif" />
    </telerik:RadAjaxLoadingPanel>
    <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>
    <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="225px">
                                </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=<%#GetDPMPlusDealer(Eval("DPM_Name").ToString(),Eval("Dealer_Name").ToString())%>&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=<%#GetDPMPlusDealer(Eval("DPM_Name").ToString(),Eval("Dealer_Name").ToString())%>&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=<%#GetDPMPlusDealer(Eval("DPM_Name").ToString(),Eval("Dealer_Name").ToString())%>&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="65px" 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=<%#GetDPMPlusDealer(Eval("DPM_Name").ToString(),Eval("Dealer_Name").ToString())%>&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=<%#GetDPMPlusDealer(Eval("DPM_Name").ToString(),Eval("Dealer_Name").ToString())%>&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=<%#GetDPMPlusDealer(Eval("DPM_Name").ToString(),Eval("Dealer_Name").ToString())%>&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="280px" 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="Avg" 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 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}%" FooterAggregateFormatString="{0:F2}%" Aggregate="Avg"
                            FooterStyle-Font-Bold="true" />
                    </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>
    </form>
</body>
</html>
Code Behind File:
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()
    {
        try
        {
            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);
            SqlDataSource1.SelectParameters["EndMonth"].DefaultValue = ToYearMonth.Substring(4, 2);
            SqlDataSource1.SelectParameters["EndYear"].DefaultValue = ToYearMonth.Substring(0, 4);
            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);
        }
        catch (Exception e)
        {
            Response.Write("Error has occured in DefineGrid structure" + e.Message);
        }
 
    }
    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";
            }
        }
        try
        {
            RadGrid grid = (RadGrid)pnlSalesByVendor.FindControl("rgPartSalesByVendor");
 
            RadAjaxManager1.AjaxSettings.Clear();
            RadAjaxManager1.AjaxSettings.AddAjaxSetting(FromMonthDropDownList, pnlSalesByVendor, RadAjaxLoadingPanel1);
            RadAjaxManager1.AjaxSettings.AddAjaxSetting(FromMonthDropDownList, pnlSalesParts, RadAjaxLoadingPanel1);
            RadAjaxManager1.AjaxSettings.AddAjaxSetting(FromMonthDropDownList, grid, RadAjaxLoadingPanel1);
        }
        catch (Exception ex)
        {
            Response.Write("Error has occured in updating Ajax" + ex.Message);
        }
 
        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;
        try
        {
 
            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;
 
            //Bind sales By vendor Grid
            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);
            RadGrid grid = (RadGrid)pnlSalesByVendor.FindControl("rgPartSalesByVendor");
            grid.DataSource = SqlDataSource1;
            grid.Rebind();
        }
        catch (Exception ex)
        {
            Response.Write("Error has occured:" + ex.Message);
        }
 
        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;
            try
            {
 
                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;
            }
            catch (Exception ex)
            {
                Response.Write("Error has occured in rgPartDashboard_Load" + ex.Message);
            }
 
        }
    }
    protected void rgPartDashboard_Detail(object source, Telerik.Web.UI.GridDetailTableDataBindEventArgs e)
    {
        string FromYearMonth = FromMonthDropDownList.SelectedValue;
        string ToYearMonth = ToMonthDropDownList.SelectedValue;
        try
        {
 
            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;
        }
        catch (Exception ex)
        {
            Response.Write("Error has occured in rgPartDashboard_Detail:" + ex.Message);
        }
    }
    protected string GetDPMPlusDealer(string DMPName, string DealerName)
    {
        return DMPName + ", " + DealerName;
    }
    protected void rgPartSalesByVendor_Load(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
    {
        if (!e.IsFromDetailTable)
        {
 
            string FromYearMonth = FromMonthDropDownList.SelectedValue;
            string ToYearMonth = ToMonthDropDownList.SelectedValue;
            try
            {
                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;
            }
            catch (Exception ex)
            {
                Response.Write("Error has occured in rgPartSalesByVendor_Load:" + ex.Message);
            }
 
        }
    }
    #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
 
 
}
Learner
Top achievements
Rank 1
 answered on 08 Oct 2014
3 answers
149 views
Hi,

I have a progress bar area on my page, I'm trying to remove ther header.  Have read that this could be done with the following style changes:
 

<style type="text/css">
RadProgressArea .ruProgress
{
    padding:15px 0 0 !important;
}
RadProgressArea_Windows7 .ruProgress
{
    background-image: none !important;
}
</style>


However this makes no difference - am I missing something?
​
Magdalena
Telerik team
 answered on 08 Oct 2014
1 answer
257 views
Hi all here,



I have doubt in how to load a text document to radeditor and then edit that document via radeditor, if anybody knows the answer please help me as i am new to use radeditor, thanks in advance.
Ianko
Telerik team
 answered on 08 Oct 2014
1 answer
75 views
I am trying to open a window with a label set from code behind.
The window opens but the label is not set

<telerik:RadCodeBlock ID="RadCodeBlock2" runat="server">
    <script type="text/javascript" language="javascript">
        function aspButtonCallbackFn(sender, args) {
            PageMethods.PrepareForSearchResult(args.get_text(), MyMethod_Result);
        }
 
        function MyMethod_Result(pResult) {
            if (pResult == 2) {
                    var wnd = $find("<%=modalPopup.ClientID %>");
                    wnd.show();
                }
    }
    </script>
</telerik:RadCodeBlock>

This is how the popup is declared:

<telerik:RadWindow
    ID="modalPopup"
    runat="server"
    AutoSizeBehaviors="Width, Height"
    AutoSize="true"
    VisibleStatusbar="false"
    Behaviors="Move"
    VisibleOnPageLoad="false"
    ReloadOnShow="true"
    Modal="true"
    EnableShadow="true">
    <ContentTemplate>
        <asp:UpdatePanel ID="PdtPnl_ForAddExisting" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
                <div style="display: table; width: 100%">
                    <div style="display: table-row; vertical-align: middle">
                        <div style="display: table-cell; padding-top: 10px; padding-left: 10px; padding-bottom: 5px; padding-right: 10px;">
                            <asp:Label
                                ID="Lbl_Pnl_ForAddExisting"
                                runat="server"
                                Text="" />
                        </div>
                    </div>
                </div>
                <div style="display: table; width: 100%">
                    <div style="display: table-row; vertical-align: middle">
                        <div style="display: table-cell; padding-top: 5px; padding-left: 10px; padding-bottom: 10px; padding-right: 5px;">
                            <asp:Button
                                ID="Bttn_Add_ForAddExisting"
                                Width="100"
                                OnClick="Bttn_Add_ForAddExisting_Click"
                                Text="Add"
                                runat="server"
                                class="button" />
                        </div>
                        <div style="display: table-cell; padding-top: 5px; padding-left: 5px; padding-bottom: 10px; padding-right: 10px;">
                            <asp:Button
                                ID="Bttn_Cancel_ForAddExisting"
                                Width="100"
                                OnClick="Bttn_Cancel_ForAddExisting_Click"
                                Text="Cancel"
                                runat="server"
                                class="button" />
                        </div>
                    </div>
                </div>
            </ContentTemplate>
        </asp:UpdatePanel>
    </ContentTemplate>
</telerik:RadWindow>

And this is the WebMethod

[WebMethod]
public static int PrepareForSearchResult(string pText)
{
    if (String.IsNullOrEmpty(pText) == true)
    {
        return -1;
    }
    _instance.Lbl_Pnl_ForAddExisting.Text = String.Format("Do you want to add '{0}'?", pText);
    _instance.PdtPnl_ForAddExisting.Update();
    return 2;
}

Not sure what I am doing wrong.
Marin Bratanov
Telerik team
 answered on 08 Oct 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?