public
static
RadHtmlChart ChartDeploymentsByRemoteImaging(List<DeploymentsView> results)
{
RadHtmlChart RadHtmlChart1 =
new
RadHtmlChart();
RadHtmlChart1.ID =
"RemoteImagingChart"
;
RadHtmlChart1.Width = Unit.Pixel(680);
RadHtmlChart1.Height = Unit.Pixel(400);
RadHtmlChart1.ChartTitle.Text =
"Remote Imaging"
;
var groups = results.GroupBy(d => d.Date.Date)
.Select(g =>
new
{
Date = g.Key,
Count = g.Count(),
RemoteCount = g.Where(d=>d.TaskSequence.ToUpper().Contains(
"OSD"
)).Count()
});
ColumnSeries series =
new
ColumnSeries();
ColumnSeries seriesRemote =
new
ColumnSeries();
series.Name =
"Local Imaging"
;
seriesRemote.Name =
"Remote Imaging"
;
series.GroupName =
"Total"
;
seriesRemote.GroupName =
"Total"
;
foreach
(var group
in
groups)
{
CategorySeriesItem seriesItem =
new
CategorySeriesItem((
decimal
?)(group.Count - group.RemoteCount));
series.SeriesItems.Add(seriesItem);
CategorySeriesItem seriesRemoteItem =
new
CategorySeriesItem((
decimal
?)(group.RemoteCount));
seriesRemote.SeriesItems.Add(seriesRemoteItem);
RadHtmlChart1.PlotArea.XAxis.Items.Add(
new
AxisItem { LabelText = group.Date.ToShortDateString() });
}
series.LabelsAppearance.Visible =
false
;
seriesRemote.LabelsAppearance.Visible =
false
;
RadHtmlChart1.PlotArea.Series.Add(series);
RadHtmlChart1.PlotArea.Series.Add(seriesRemote);
RadHtmlChart1.PlotArea.XAxis.BaseUnit = Telerik.Web.UI.HtmlChart.DateTimeBaseUnit.Months;
RadHtmlChart1.PlotArea.XAxis.Type = Telerik.Web.UI.HtmlChart.AxisType.Date;
return
RadHtmlChart1;
}
For a new project I am working on, I am going to make use of the RadHtmlChart that would be bound to a dataset to do a Bar Chart.
First I needed to get familiar with the RadHtmlChart and binding a dataset to it. To do that I started with the demos. First I created an ASP.Net page with VB.net as the code behind. I had copied the ASP.net code from the demo to the ASP.Net page I created and copied the vb code-behind to the code-behind for the ASP.Net page I created. When I try to display that ASP.Net page in my web browser, it showed the chart without the lines that should have been plotted based on the data. See the attached screenshot.
I have even tried the example code in the documentation for using a dataset and still did not work.
Why is this NOT working?
It should be simple and straight-forward but it is not working. I have tried it in IE11 and Google Chrome. I have bind other Telerik controls to datasets before without any problems.
Please DO NOT refer me to the example in the documentation and the demo because they are not working.
Please LOOK at my code below and help find out why it is NOT working.
---------------------------------------------------------------------
TestRadHTMLChart.aspx -
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="TestRadHtmlChart.aspx.vb" Inherits="TestRadHtmlChart" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
<title>Telerik ASP.NET Example</title>
</head>
<body>
<form id="form1" runat="server">
<telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
<telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
<div class="demo-container size-wide">
<telerik:RadHtmlChart runat="server" ID="RadHtmlChart1" Width="800px" Height="500px">
<PlotArea>
<Series>
<telerik:ScatterLineSeries Name="0.8C" DataFieldX="ChargeTime08C" DataFieldY="ChargeCurrent08C">
<TooltipsAppearance Color="White" DataFormatString="{1}% in {0} minutes"></TooltipsAppearance>
<LabelsAppearance Visible="false">
</LabelsAppearance>
</telerik:ScatterLineSeries>
<telerik:ScatterLineSeries Name="1.6C" DataFieldX="ChargeTime16C" DataFieldY="ChargeCurrent16C">
<TooltipsAppearance Color="White" DataFormatString="{1}% in {0} minutes"></TooltipsAppearance>
<LabelsAppearance Visible="false">
</LabelsAppearance>
</telerik:ScatterLineSeries>
<telerik:ScatterLineSeries Name="3.1C" DataFieldX="ChargeTime31C" DataFieldY="ChargeCurrent31C">
<TooltipsAppearance Color="White" DataFormatString="{1}% in {0} minutes"></TooltipsAppearance>
<LabelsAppearance Visible="false">
</LabelsAppearance>
</telerik:ScatterLineSeries>
</Series>
<XAxis>
<LabelsAppearance DataFormatString="{0}m" />
<TitleAppearance Text="Time" />
</XAxis>
<YAxis MaxValue="100">
<LabelsAppearance DataFormatString="{0}%" />
<TitleAppearance Text="Charge" />
</YAxis>
</PlotArea>
<ChartTitle Text="Charge current vs. charge time">
</ChartTitle>
</telerik:RadHtmlChart>
</div>
</form>
</body>
</html>
TestRadHtmlChart.aspx.vb -
Imports System
Imports System.Data
Partial Class TestRadHtmlChart
Inherits System.Web.UI.Page
Protected Sub Page_Load(sender As Object, e As System.EventArgs)
RadHtmlChart1.DataSource = GetData()
RadHtmlChart1.DataBind()
End Sub
Private Function GetData() As DataSet
Dim ds As New DataSet("ChargeCurrentTimeRatio")
Dim dt As New DataTable("ChargeData")
dt.Columns.Add("Id", Type.[GetType]("System.Int32"))
dt.Columns.Add("ChargeTime08C", Type.[GetType]("System.Decimal"))
dt.Columns.Add("ChargeCurrent08C", Type.[GetType]("System.Decimal"))
dt.Columns.Add("ChargeTime16C", Type.[GetType]("System.Decimal"))
dt.Columns.Add("ChargeCurrent16C", Type.[GetType]("System.Decimal"))
dt.Columns.Add("ChargeTime31C", Type.[GetType]("System.Decimal"))
dt.Columns.Add("ChargeCurrent31C", Type.[GetType]("System.Decimal"))
dt.Rows.Add(1, 10, 10, 10, 40, 10, _
70)
dt.Rows.Add(2, 15, 20, 17, 50, 13, _
90)
dt.Rows.Add(3, 20, 25, 18, 70, 25, _
100)
dt.Rows.Add(4, 32, 40, 35, 90, Nothing, _
Nothing)
dt.Rows.Add(5, 43, 50, 47, 95, Nothing, _
Nothing)
dt.Rows.Add(6, 55, 60, 60, 100, Nothing, _
Nothing)
dt.Rows.Add(7, 60, 70, Nothing, Nothing, Nothing, _
Nothing)
dt.Rows.Add(8, 70, 80, Nothing, Nothing, Nothing, _
Nothing)
dt.Rows.Add(9, 90, 100, Nothing, Nothing, Nothing, _
Nothing)
ds.Tables.Add(dt)
Return ds
End Function
End Class
I have a RadWizard with the steps created dynamically in the OnInit function ( IsPostback = false )
I have a server OnNextButtonClick event set.
On the dynamically created step I have a RadTextBox with an ClientEvents.OnValueChanged event set
If I enter data on the RadTextBox and tab off it the OnValueChanged fires correctly
If I click the 'Next' button the OnNextButtonClick fires correctly
However...
If I enter data in the RadTextBox and click the 'Next' button without leaving the RadTextBox the OnValueChanged event fires but the OnNextButtonClick event does not fire.
How do I get both events to fire when the 'Next' button is clicked?
I have an ASP.Net page I am trying to use the RadWindow and RadTabStrip on. The ASP.Net page has some RadButtons on it. Each button is for a different Line.
I am trying to develop the ASP.net page so that when the user clicks on a button which opens a new window to a different ASP.Net page.
Here are the problems I am running into:
- A window is opened upon the page being loaded. There should not be any window created and opened when the page is loaded. Only when a button is clicked on that new window appears.
- In a new window, the ASP.Net page is getting the same value ... BL1. If a button for BL4 is clicked on then the new window should show BL4 in the ASP.Net page it loaded.
- For each new window opened, the tabstrip expands causing the buttons to be pushed down further in the page. The buttons need to stay in the same place no matter how many windows are opened.
Basically, I am trying to do something similiar to the demo for the RadWindow when you click on the Overview.
Below is my code.
Attached is a screenshot of what happens when the page loads.
Please help me to find a solution to my issues above. Thanks!
Sincerely,
Keith Jackson
Below is my code.
TestRadWindow.aspx
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="TestRadWindowPage.aspx.vb" Inherits="TestRadWindowPage" %>
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
html .RadMenu .rmLink,
html .RadMenu .rmHorizontal .rmText {
float: none;
padding: 0;
text-align: center;
}
.restrictionZone {
height: 967px;
width:960px;
border: solid 1px black;
}
.RadWindow .rwWindowContent
{
background-image: url('images/SteelWallpaper1.jpg') !important;
}
.LineDiv1 {
text-wrap:none;
width: 740px;
height: 172px;
background-color: white;
box-shadow: 10px 10px 5px #101010;
}
.LineDiv2 {
text-wrap:none;
text-indent:3px;
width: 200px;
height: 172px;
background-color: white;
box-shadow: 10px 10px 5px #101010;
}
</style>
<script type="text/javascript" src="/scripts/jquery.min.js"></script>
<script type = "text/javascript" >
function tabStrip_load(sender, args) {
tabStrip = sender;
} function OnClientTabSelected(sender, args) {
//get the current windows collection
var selIndex = tabStrip.get_selectedIndex();
OpenWindowByIndex(selIndex);
}
function OpenWindowByIndex(index) {
var windows = demo.manager.get_windows();
for (var i = 0; i < windows.length; i++) {
var win = windows[i];
if (i == index) {
//Only show window if it is not currently visible to prevent recursion of RadWindow OnClientShow calling RadTabStrip OnClientTabSelected
if (!win.isVisible()) {
win.show();
win.center();
}
}
else {
win.hide();
}
}
}
function openNewWindow(sWrkctr) {
//var windowURL = urlTextBox.get_textBoxValue();
//var oWnd = radopen("CoilUptimeHistory.aspx?WRKCTR=" + sWrkctr, null);
var oWnd = GetRadWindowManager().open("CoilUptimeHistory.aspx?WRKCTR=" + sWrkctr, null);
oWnd.center();
//var websiteName = getWebsiteName(oWnd.get_navigateUrl());
//Add new tab to the tabstrip
tabStrip.trackChanges();
var tab = new Telerik.Web.UI.RadTab();
tab.set_text(sWrkctr + ' Coil Uptime History');
tabStrip.get_tabs().add(tab);
//var iconUrl = oWnd.get_navigateUrl() + "/favicon.ico";
//if (iconUrl.indexOf("converter.telerik.com") > 0) iconUrl = "codeConverterFavicon.ico";
//if (iconUrl.indexOf("www.telerik.com") > 0) iconUrl = "telerikFavicon.ico";
//if (iconUrl.indexOf("www.w3.org") > 0) iconUrl = "w3Favicon.png";
//tab.set_imageUrl(iconUrl);
tabStrip.commitChanges();
//Select this tab
tab.select();
}
</script>
</head>
<body style="background-color: #3A4459">
<form id="form1" runat="server">
<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
<Scripts>
<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js">
</asp:ScriptReference>
<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js">
</asp:ScriptReference>
<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js">
</asp:ScriptReference>
</Scripts>
</telerik:RadScriptManager>
<telerik:RadMenu ID="RadMenu1" Runat="server" Width="960px" Style="z-index: 100">
<Items>
<telerik:RadMenuItem runat="server" Font-Bold="True" Font-Size="14pt" NavigateUrl="CustomerPortal" Text="Home" Width="475px">
</telerik:RadMenuItem>
<telerik:RadMenuItem runat="server" IsSeparator="True" Text="Sep">
</telerik:RadMenuItem>
<telerik:RadMenuItem runat="server" Font-Bold="True" Font-Size="14pt" ForeColor="Red" Text="Logout" Width="475px">
</telerik:RadMenuItem>
</Items>
</telerik:RadMenu>
<telerik:RadTabStrip OnClientTabSelected="OnClientTabSelected" ID="RadTabStrip1"
Orientation="VerticalLeft" runat="server" OnClientLoad="tabStrip_load">
</telerik:RadTabStrip>
<telerik:RadWindowManager ID="RadWindowManager1" runat="server" VisibleOnPageLoad="false">
</telerik:RadWindowManager>
<br />
<br />
<br />
<telerik:RadButton ID="rbtnBL1OpenRadWin" OnClientClicked="openNewWindow('BL1')" AutoPostBack="false" runat="server" Text="BL1 Open RadWindow" RenderMode="Classic" Font-Size="11pt">
</telerik:RadButton>
<br />
<br />
<telerik:RadButton ID="rbtnBL2OpenRadWin" OnClientClicked="openNewWindow('BL2')" AutoPostBack="false" runat="server" Text="BL2 Open RadWindow" RenderMode="Classic" Font-Size="11pt">
</telerik:RadButton>
<br />
<br />
<telerik:RadButton ID="rbtnBL3OpenRadWin" OnClientClicked="openNewWindow('BL3')" AutoPostBack="false" runat="server" Text="BL3 Open RadWindow" RenderMode="Classic" Font-Size="11pt">
</telerik:RadButton>
<br />
<br />
<telerik:RadButton ID="rbtnBL4OpenRadWin" OnClientClicked="openNewWindow('BL4')" AutoPostBack="false" runat="server" Text="BL4 Open RadWindow" RenderMode="Classic" Font-Size="11pt">
</telerik:RadButton>
<br />
<br />
<telerik:RadButton ID="rbtnCTLOpenRadWin" OnClientClicked="openNewWindow('CTL')" AutoPostBack="false" runat="server" Text="CTL Open RadWindow" RenderMode="Classic" Font-Size="11pt">
</telerik:RadButton>
</form>
</body>
</html>
TestRadWindowPage
Is it possible to create or open a RadWindow without using a javascript function?
The reason I ask is because I have an ASP.Net page with multiple UpdatePanels that is updated by a Timer every few seconds. Each UpdatePanel has a button for the user to click on to open another ASP.Net page with a Bar Chart.
I have found a way to get a button within an UpdatePanel to work and to get a button outside of an UpdatePanel to work. But as soon as I set up the button to call a javascript function directly using OnClientClicked or from the code behind, nothing happens when clicking on the buttons.
It would be nice to be able to open a window without using a javascript function.
Maybe there is a way to do it using the RadWindowManager.
Please help.
Sincerely,
Keith Jackson
Hi,
When rendering the RadGrid in RenderMode=Mobile there are no check boxes to Show/Hide the columns from "Menu/Columns display".
The check boxes are there if I have any other RenderMode (like Classic or LightWeight).
Does anyone know how to get the check boxes ?
Thanks
/Mats
I've look through all the available examples for the integration of odata in grid and none was helpful, maybe what I want is not available with radgrid for asp.net.
What I want : A simple server side datasource binding to a odata source like if I was binding to a entity collection.
I want the most simple example to demonstrate that its simple to group, sort and filter an odata feed through a telerik grid. My feed is a odata v3. I do not want client-side binding because it tends to be complexe scripting option.
I want something like that :
var grid = new radgrid();
grid.datasource = new IDatasource("http://someithing/odata") // theres any Odatadatasource implementing IDatasource?
grid.autogeratecollumns = true
grid.enablegrouping = true
grid.enablesorting = true
grid.enablefiltering = true
Thanks for any help!
Hi,
We are using radgrid and in itemdatabound we are using below code to get the text but when we are trying to read values we are getting " ". This started happening after we upgraded to latest telerik dll. we were able to read values with the old telerik dll. Is this a known issues if so what options do we have in reading the values of GridDataItem in ItemDataBound event.
Dim lblColumnName As Label = DirectCast(item.FindControl("lblColumnName"), Label)
lblColumnName.Text = item.Item("ColumnName").Text