<%@ Page Title="Tickets Received by Time of Day" Language="VB" AutoEventWireup="false" CodeFile="TixByTime.aspx.vb" Inherits="Statistics_Misc_TixByTime" MasterPageFile="~/MasterPage.master" %><%@ MasterType VirtualPath="~/MasterPage.master" %><%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Charting" TagPrefix="telerik" %><asp:Content ID="cpHeadContent" ContentPlaceHolderID="mpHeadContent" runat="server"></asp:Content><asp:Content ID="cpSideMenuContent" ContentPlaceHolderID="mpSideMenuContent" runat="server"></asp:Content><asp:Content ID="cpMainContent" ContentPlaceHolderID="mpMainContent" runat="server"> <telerik:RadChart ID="rcChart2" runat="server" Height="500px" Width="900px" Skin="WebBlue"> </telerik:RadChart></asp:Content>Imports WorkforceImports System.DataImports Telerik.ChartingImports System.Data.SqlClientPartial Class Statistics_Misc_TixByTIme Inherits System.Web.UI.Page Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load SetupChart() LoadData() End Sub Private Sub SetupChart() Dim dStart As Double = DateTime.Today.ToOADate() Dim dEnd As Double = DateTime.Today.AddDays(1).ToOADate() Dim dHourStep As Double = (1 / 24) With rcChart2 .ChartTitle.TextBlock.Text = "Tickets Received by Time of Day" .SeriesOrientation = ChartSeriesOrientation.Vertical With .PlotArea.XAxis .AutoScale = False .IsZeroBased = False .LayoutMode = Styles.ChartAxisLayoutMode.Inside .AddRange(dStart, dEnd, dHourStep) .Appearance.MajorGridLines.Visible = False .Appearance.ValueFormat = Styles.ChartValueFormat.ShortTime .Appearance.CustomFormat = "hh:mm tt" .Appearance.LabelAppearance.RotationAngle = 90 .Appearance.LabelAppearance.Position.AlignedPosition = Styles.AlignedPositions.Top End With With .PlotArea.YAxis .Step = 1 End With Dim oSeries As New ChartSeries() With oSeries .Name = "TicketCounts2" .Type = ChartSeriesType.Area .Appearance.ShowLabels = False End With .Series.Add(oSeries) End With End Sub Private Sub LoadData() Dim oSeries As ChartSeries = rcChart2.Series(0) Dim oConn As SqlConnection = Nothing Dim oReader As SqlDataReader = Nothing Dim oCmd As SqlCommand = New SqlCommand() Dim sSQL As String Try Dim sConn As String = Profile.Company.ConnectionString oConn = New SqlConnection(sConn) oConn.Open() sSQL = <sql> SELECT Substring(Convert(nchar(8),recvdatetime,8), 1, 5) AS daTime ,Count(*) AS daCount FROM cwtg..tix4tbl group by substring(convert(nchar(8),recvdatetime,8), 1, 5) order by daTime </sql>.Value oCmd.CommandText = sSQL oCmd.Connection = oConn oReader = oCmd.ExecuteReader() Do While oReader.Read Dim dTime As Double = DateTime.Parse(oReader.GetString(oReader.GetOrdinal("daTime"))).ToOADate() Dim dCount As Double = oReader.GetInt32(oReader.GetOrdinal("daCount")) Dim oItem As New ChartSeriesItem() oItem.XValue = dTime oItem.YValue = dCount oSeries.Items.Add(oItem) Loop Finally If oReader IsNot Nothing Then oReader.Close() oConn.Close() oConn.Dispose() End Try End SubEnd Class

RadDatePicker date = new RadDatePicker(); date.EnableTyping = false; date.ShowPopupOnFocus = true;
protected void btnGenerate_Click(object sender, EventArgs e)
{
PopulateGrid();
}
protected void PopulateGrid()
{
GridPlaceHolder.Controls.Clear();
RadGrid GridReport = new RadGrid();
GridReport.GroupingSettings.CaseSensitive =
false;
GridReport.ID =
"GridReport";
GridReport.Skin =
"Gray";
GridReport.EnableViewState =
false;
GridReport.MasterTableView.EnableColumnsViewState =
false;
GridReport.Width =
Unit.Pixel(1413);
GridReport.Height =
Unit.Pixel(550);
GridReport.AllowPaging =
true;
GridReport.AllowSorting =
true;
GridReport.PageSize = 10;
GridReport.MasterTableView.AllowCustomPaging =
true;
GridReport.AutoGenerateColumns =
false;
GridReport.AllowFilteringByColumn =
false;
GridReport.EnableLinqExpressions =
false;
GridReport.GridLines =
GridLines.None;
GridReport.NeedDataSource +=
new GridNeedDataSourceEventHandler(this.GridReport_NeedDataSource);
GridReport.PageIndexChanged +=
new GridPageChangedEventHandler(this.GridReport_PageIndexChanged);
GridReport.PagerStyle.Mode =
GridPagerMode.NextPrevNumericAndAdvanced;
GridReport.ClientSettings.Scrolling.AllowScroll =
true;
GridReport.ClientSettings.Scrolling.UseStaticHeaders =
true;
GridReport.ClientSettings.Resizing.AllowColumnResize =
true;
GridReport.ClientSettings.Resizing.EnableRealTimeResize =
true;
GridReport.MasterTableView.AllowSorting =
true;
GridReport.MasterTableView.AllowNaturalSort =
false;
GridReport.MasterTableView.HierarchyLoadMode =
GridChildLoadMode.ServerOnDemand;
GridReport.ClientSettings.AllowExpandCollapse =
true;
GridReport.MasterTableView.TableLayout =
GridTableLayout.Fixed;
GridReport.MasterTableView.Width =
Unit.Pixel(1413);
GridReport.FilterMenu.EnableAjaxSkinRendering =
true;
GridReport.ClientSettings.AllowColumnsReorder =
false;
GridReport.ClientSettings.AllowDragToGroup =
false;
GridReport.ClientSettings.ReorderColumnsOnClient =
true;
GridReport.ClientSettings.Resizing.ResizeGridOnColumnResize =
true;
GridReport.ClientSettings.Resizing.ClipCellContentOnResize =
true;
GridReport.ClientSettings.EnableRowHoverStyle =
true;
GridReport.ClientSettings.ClientEvents.OnRowSelected =
"RowSelected";
GridReport.ClientSettings.Selecting.AllowRowSelect =
true;
LoadReport(GridReport);
GridPlaceHolder.Controls.Add(GridReport);
}
private void LoadReport(RadGrid GridReport)
{
string reportName = "Report_Operations";
switch (reportName )
{
case "Report_Operations":
GridReport.MasterTableView.DataKeyNames =
new string[] { "OperationID" };
GridReport = BLL.BO.Reports.
Operations.GenerateReportColumns(ref GridReport);
break;
}
private void GridReport_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
{
//do something
GridReport.DataSource = dt;}
void GridReport_PageIndexChanged(object source, GridPageChangedEventArgs e)
{
// DO SOMETHING, HERE THE BREAKPOINT NEVER HITS!
}
Thanks for your help!
How do I access a GridTemplateColumn in the Grid row that was clicked?
With the getDataKeyValue() method I can get the value of GridBoundColumns after defining the columns using the ClientDataKeyNames property of the MasterTableView.
But how can I get the value of GridTemplateColumns?