Telerik Forums
UI for ASP.NET AJAX Forum
5 answers
572 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
168 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
181 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
393 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
157 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
278 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
85 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
4 answers
281 views

I am using advanced binding and creating dynamic columns during Page_Init event.
Everything works fine except column groups.

I am creating column groups based on my data and then linking them to columns eventually in page_init event.

Below is the code I am trying to use. Everything is fine on first load. When we try to refresh grid, nothing works. I am getting "Invalid Column Name" error.


            DataSet dsSubmittals = new DataSet();
            DataSet dsCycles = new DataSet();
            string SubID = Session["SubmitalID"].ToString();
            if (Session["SubmitalID"] != null)
            {
                dsCycles = _dv.GetProjectCycles(ProjectID);
                //for (int k = 0; k < dsCycles.Tables[0].Rows.Count; k++)
                //{
                //    GridColumnGroup CycleGroup = new GridColumnGroup();
                //    CycleGroup.HeaderText = dsCycles.Tables[0].Rows[k]["CycleName"].ToString();
                //    CycleGroup.Name = dsCycles.Tables[0].Rows[k]["CycleID"].ToString();
                //    RadGridResults.MasterTableView.ColumnGroups.Add(CycleGroup);

                //}

                //GridColumnGroup CycleGroup1 = new GridColumnGroup();
                //CycleGroup1.HeaderText = "Final Status";
                //CycleGroup1.Name = "Final_Status";
                //RadGridResults.MasterTableView.ColumnGroups.Add(CycleGroup1);

                int index = 4;
                if (dsCycles.Tables[0].Rows.Count > 1)
                {
                    for (int j =1;j< dsCycles.Tables[0].Rows.Count; j++)
                    {

                        string colName = dsCycles.Tables[0].Rows[dsCycles.Tables[0].Rows.Count-j]["CycleName"].ToString();
                        string CycleIdValue = dsCycles.Tables[0].Rows[dsCycles.Tables[0].Rows.Count-j]["CycleID"].ToString();
                        colName = colName.Replace(" ", string.Empty);
                        bool chk = false;
                        for (int k = 0; k < RadGridResults.Columns.Count; k++)
                        {
                            if (RadGridResults.Columns[k].UniqueName != string.Empty)
                                if (RadGridResults.Columns[k].UniqueName == colName)
                                {
                                    RadGridResults.Columns[k].HeaderText = RadGridResults.Columns[k].UniqueName;
                                    chk = true;
                                    break;
                                }
                        }
                        if (!chk)
                        {
                            int loc = index + j;
                            GridBoundColumn bf = new GridBoundColumn();
                            bf.DataField = colName.Trim();
                            bf.HeaderStyle.Width = 55;
                            bf.FilterControlWidth = 22;
                            bf.UniqueName = colName.Trim();
                            bf.HeaderText = colName.Trim();
                            bf.HeaderText = colName.Trim();
                            bf.SortExpression = colName;
                            bf.FooterText = CycleIdValue;
                            bf.HeaderButtonType = GridHeaderButtonType.TextButton;
                           // bf.ColumnGroupName = "Final_Status";
                            RadGridResults.MasterTableView.Columns.AddAt(loc, bf);

                           

                        }
                    }
                }


Thanks,
Anil
Pavlina
Telerik team
 answered on 08 Oct 2014
5 answers
146 views
Hi,

I use the RadEditor inside a input form with dynamic content. Dependent of the selected record in a Radgrid different input control become visible. When an input control is not visible, its replaced to a seperate div to make room for other input controls. Because the RadEditor is replaced on the DOM I call editor.OnParentChanged() to let the RadEditor behave as expected especially in Firefox and IE 10 and lower. If I don't the RadEditor steals focus and its content becomes empty.

This works great when the RadEditor becomes visible, but when the RadEditor becomes invisible it still steals the focus.This is a problem for pressed shortkeys in the RadGrid to navigate through records because they stop work after the focus is stolen. The content of the RadEditor stays filled when it is invisible as expected.

The strange thing is, the focus is not stolen the first time the RadEditor becomes invisible.

Any ideas what goes wrong in my situation?

Ianko
Telerik team
 answered on 08 Oct 2014
1 answer
561 views
With the Microsoft Validator controls (RequiredFieldValidator in this case) the typical behavior is for validation logic to run when you tab out of the field, or on submit. 

I have noticed with RadComboBox this is **not** the case, even in your own online demo. Rather, with RCB validation *only* occurs when you attempt to submit. Is there any way to force this to validate on tab out? Typically the field would look something like this in code:

1.<telerik:RadComboBox ID="rcbPatientMaritalStatus" EmptyMessage="Start typing marital status or select one" MarkFirstMatch="true" TabIndex="8" Width="160" runat="server">
2.    <Items>
3.        <telerik:RadComboBoxItem Text="Single" Value="Single" />
4.        <telerik:RadComboBoxItem Text="Married" Value="Married" />
5.        <telerik:RadComboBoxItem Text="Other" Value="Other" />
6.    </Items>
7.</telerik:RadComboBox>
1.<asp:RequiredFieldValidator ID="rfvPatientMaritalStatus" ControlToValidate="rcbPatientMaritalStatus" ErrorMessage="Marital Status Required" Display="None" Visible="false" runat="server" />
Nencho
Telerik team
 answered on 08 Oct 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?