Telerik Forums
UI for ASP.NET AJAX Forum
0 answers
117 views
Hello,

I have a RadToolbar and a div that should load contents of another page using jquery.  Does anyone know why this error occurs:
SysArgumentTypeException
Object of type 'Telerik.Web.UI.RadToolbarCancelEventArgs' cannot be converted to type 'Sys.CancelEventArgs'

Any help would be appreciated!

<telerik:RadScriptManager ID="tmgRSM" runat="server" EnableCdn="true">
            <Scripts>
               <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
               <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
               <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
           </Scripts>
        </telerik:RadScriptManager>
  
        <telerik:RadToolBar ID="radToolBar1" runat="server"
                Width="100%" EnableViewState="false" OnClientButtonClicking="OnToolBarButtonClick">
                <Items>
                    <telerik:RadToolBarButton Text="Tab1" CommandName="Tab1" CheckOnClick="true" Checked="true"></telerik:RadToolBarButton>
                    <telerik:RadToolBarButton IsSeparator="true"></telerik:RadToolBarButton>
                    <telerik:RadToolBarButton Text="Tab2" CommandName="Tab2" CheckOnClick="true"></telerik:RadToolBarButton>
                </Items> 
        </telerik:RadToolBar>
          
        <div id="contentDiv" style="padding-left:20px"></div>
  
        <telerik:RadCodeBlock runat="server" ID="RadCodeBlock1">
            <script type="text/javascript">
                window.$ = $telerik.$;
  
                $(document).ready(function () {
                    $('#contentDiv').load('Content.aspx');
                });     
  
                function OnToolBarButtonClick(sender, args) {
                    alert(args.get_item().get_commandName());
                }
            </script>
        </telerik:RadCodeBlock>
Cheryl
Top achievements
Rank 1
 asked on 09 May 2013
2 answers
211 views
I am writing an application that creates potentially multiple dynamic charts on a page from parameters saved in a database.  When the page initially loads the charts are created after getting information from the database.  There is a timer on the page that executes a postback and I have code in the "IsPostback" block on page load that calls the function used to create the chart with the same parameters being passed as well as a call to the database to get the new values to update the chart.

I can see that the new values are present when the code is run from the timer postback to create the chart and I can see through fiddler that the image never gets created because "chartimage.axd" never gets called again after the initial non-postback load on the server to be sent back to the browser.  What am I missing to make this work properly?

Thanks for any help that can be provided.

James

Code block run the initial time that chart is successfully created as well as each time after that when the timer fires.
ChartSubpanelsTimer.Enabled = true;
if (ConfigurationManager.AppSettings["ChartUpdateFrequency"] != "")
    ChartSubpanelsTimer.Interval = Convert.ToInt32(ConfigurationManager.AppSettings["ChartUpdateFrequency"])*1000;
 
WpfChartSubpanelProperties chartProps = (WpfChartSubpanelProperties)subPanelProps;
ViewState.Add("__Chart__" + subpanelCount, chartProps);
 
if (chartProps.StreamId.ToString() != Guid.Empty.ToString())
{
    initScript += GetNewDataStreamIdScript(chartProps.StreamId.ToString(), chartProps.DataMappingFilter);
}
 
initScript += string.Format("subpanels[{0}].dataStreams[0] = new dataStreamInfo(); ", subpanelCount);
initScript += string.Format("subpanels[{0}].dataStreams[0].id = '{1}'; ", subpanelCount, chartProps.StreamId.ToString());
initScript += string.Format("subpanels[{0}].dataStreams[0].keyField = '{1}'; ", subpanelCount, chartProps.KeyField);
initScript += string.Format("subpanels[{0}].dataStreams[0].dataMappingFilter = \"{1}\"; ", subpanelCount, chartProps.DataMappingFilter);
 
string strChartName = "";
int iChartWidth = chartProps.Width;
int iChartHeight = chartProps.Height;
int iChartTopPadding = 0;
int iChartLeftPadding = 0;
int iChartTop = chartProps.Top;
int iChartLeft = chartProps.Left;
keyField = chartProps.KeyField;
 
//Set up all common chart properties
RadChart newChart = new RadChart();
//Give chart ID
newChart.ID = chartProps.Name;
//set the background color
newChart.BackColor = chartProps.BackColor;
//set the chart size
newChart.Width = iChartWidth;
newChart.Height = iChartHeight;
//set the border size and color
newChart.Appearance.Border.Width = chartProps.BorderWidth;
newChart.Appearance.Border.Color = chartProps.BorderColor;
 
//Set the Chart Title and Appearance
newChart.ChartTitle.Appearance.Position.AlignedPosition = AlignedPositions.Top;
newChart.ChartTitle.Appearance.Dimensions.AutoSize = false;
newChart.ChartTitle.Appearance.Dimensions.Width = iChartWidth - (chartProps.BorderWidth * 2);
newChart.ChartTitle.Appearance.Dimensions.Height = 30;
newChart.ChartTitle.Appearance.FillStyle.FillType = FillType.Solid;
newChart.ChartTitle.Appearance.FillStyle.MainColor = Color.SaddleBrown;
 
//Set the Chart Title Textblock Properties
newChart.ChartTitle.TextBlock.Text = chartProps.Title;
newChart.ChartTitle.TextBlock.Appearance.TextProperties.Font = new Font(chartProps.TitleFont.Name, chartProps.TitleFont.Size, chartProps.TitleFont.Style);
newChart.ChartTitle.TextBlock.Appearance.TextProperties.Color = Color.White;
newChart.ChartTitle.TextBlock.Appearance.Position.AlignedPosition = AlignedPositions.Top;
 
//Charts don't allow autonscaling so cut it off
newChart.PlotArea.YAxis.AutoScale = false;
newChart.PlotArea.XAxis.AutoScale = false;
 
//Setup the legend
newChart.Legend.Appearance.Location = LabelLocation.OutsidePlotArea;
switch (chartProps.LegendPosition)
{
    case ChartLegendLocation.Right:
        newChart.Legend.Appearance.Position.AlignedPosition = AlignedPositions.Right;       
        break;
    case ChartLegendLocation.Left:
        newChart.Legend.Appearance.Position.AlignedPosition = AlignedPositions.Left;
        break;
    case ChartLegendLocation.Top:
        newChart.Legend.Appearance.Position.AlignedPosition = AlignedPositions.Top;
        break;
    case ChartLegendLocation.Bottom:
        newChart.Legend.Appearance.Position.AlignedPosition = AlignedPositions.Bottom;
        break;
    case ChartLegendLocation.None:
        newChart.Legend.Visible = false;
        break;
}
 
//retrieve data
DataTable data = GetDataStream(chartProps.StreamId, chartProps.DataMappingFilter) ?? new DataTable();
var view = new DataView(data);
 
newChart.Series.ClearItems();
 
if (chartProps.PlotType == ChartPlotType.Graph)
{
    //Set the chart scale MIN and MAX values
    newChart.PlotArea.YAxis.MinValue = chartProps.MinChartValue;
    newChart.PlotArea.YAxis.MaxValue = chartProps.MaxChartValue;
 
    //Loop through and add each series in chart
    foreach (TDS.QuickCOM.ImageProfile.ChartSeriesProperties chartField in chartProps.ChartFields)
    {
        ChartSeries chartSeries = new ChartSeries();
        chartSeries.Appearance.LabelAppearance.Visible = true;
        chartSeries.Name = chartField.Text;
 
        switch (chartField.SeriesType)
        {
            case GridSeriesType.Area:
                chartSeries.Type = ChartSeriesType.Area;
                break;
            case GridSeriesType.Bar:
                //if horizontal bar then
                chartSeries.Type = ChartSeriesType.Bar;
                newChart.SeriesOrientation = ChartSeriesOrientation.Vertical;
                //set the X Axis
                newChart.PlotArea.XAxis.Clear();
                foreach (DataRow dr in data.Rows)
                {
                    newChart.PlotArea.XAxis.AddItem((string)dr[keyField]);
                    chartSeries.AddItem((double)(long)dr[chartField.Field]);
                }
                //configure the tick settings for chart
                ConfigureChartTickSettings(chartProps.TickRatio, newChart);
                //set the Y axis
                 
                 
                break;
            case GridSeriesType.HorizontalBar:
                chartSeries.Type = ChartSeriesType.Bar;
                newChart.SeriesOrientation = ChartSeriesOrientation.Horizontal;
                break;
            case GridSeriesType.Line:
                chartSeries.Type = ChartSeriesType.Line;
                chartSeries.Appearance.LineSeriesAppearance.Color = Color.FromName(chartField.SeriesColor.ToString());
                break;
            case GridSeriesType.Spline:
                chartSeries.Type = ChartSeriesType.Spline;
                chartSeries.Appearance.LineSeriesAppearance.Color = Color.FromName(chartField.SeriesColor.ToString());
                break;
            case GridSeriesType.SplineArea:
                chartSeries.Type = ChartSeriesType.SplineArea;
                break;
        }
 
         
        //add series to chart
        newChart.Series.Add(chartSeries);
    }
 
}
else if (chartProps.PlotType == ChartPlotType.Doughnut)
{
 
 
}
else if (chartProps.PlotType == ChartPlotType.Pie)
{
 
 
}
else if (chartProps.PlotType == ChartPlotType.TimeSeries)
{
 
 
}
 
System.Web.UI.WebControls.Panel ChartPanel = new System.Web.UI.WebControls.Panel();
ChartPanel.Controls.Add(newChart);
RadAjaxManager1.AjaxSettings.AddAjaxSetting(ChartSubpanelsTimer, newChart);
 
//Add RadialGauge object to the div wrapper
ChartPanel.ID = string.Format("StylePanel_{0}", chartProps.Name);
ChartPanel.Height = iChartHeight;
ChartPanel.Width = iChartWidth;
//set style and background image for panel
ChartPanel.Attributes.Add("style", string.Format("background-repeat:no-repeat; position: fixed; top: {0}px; left: {1}px; width: {2}px; height: {3}px; padding-left: {4}px; padding-top: {5}px;", iChartTop, iChartLeft, iChartWidth, iChartHeight, iChartLeftPadding, iChartTopPadding));
 
RadAjaxPanel gaugeAjaxPanel = new RadAjaxPanel();
gaugeAjaxPanel.ID = string.Format("UpdatePanel_{0}", chartProps.Name);
gaugeAjaxPanel.Controls.Add(ChartPanel);
form1.Controls.Add(gaugeAjaxPanel);

 
break;

My HttpHandler sections.
  <httpHandlers>
    <add verb="*" path="Dart.PowerWEB.LiveControls.GetResource.aspx" type="Dart.PowerWEB.LiveControls.ResourceHttpHandler,Dart.PowerWEB.LiveControls" />
    <add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" validate="false" />
    <add path="ChartImage.axd" type="Telerik.Web.UI.ChartHttpHandler" verb="*" validate="false" />
    <add path="Telerik.Web.UI.SpellCheckHandler.axd" type="Telerik.Web.UI.SpellCheckHandler" verb="*" validate="false" />
    <add path="Telerik.Web.UI.DialogHandler.aspx" type="Telerik.Web.UI.DialogHandler" verb="*" validate="false" />
    <add path="Telerik.RadUploadProgressHandler.ashx" type="Telerik.Web.UI.RadUploadProgressHandler" verb="*" validate="false" />
  </httpHandlers>
 
<system.webServer>
  <validation validateIntegratedModeConfiguration="false" />
  <modules runAllManagedModulesForAllRequests="true" />
  <handlers>     
    <remove name="ChartImage_axd" />
    <remove name="Telerik_Web_UI_SpellCheckHandler_axd" />
    <remove name="Telerik_Web_UI_DialogHandler_aspx" />
    <remove name="Telerik_RadUploadProgressHandler_ashx" />
    <remove name="Telerik_Web_UI_WebResource_axd" /><add name="Telerik_Web_UI_WebResource_axd" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" preCondition="integratedMode" />
    <add name="ChartImage_axd" path="ChartImage.axd" type="Telerik.Web.UI.ChartHttpHandler" verb="*" preCondition="integratedMode" />
    <add name="Telerik_Web_UI_SpellCheckHandler_axd" path="Telerik.Web.UI.SpellCheckHandler.axd" type="Telerik.Web.UI.SpellCheckHandler" verb="*" preCondition="integratedMode" />
    <add name="Telerik_Web_UI_DialogHandler_aspx" path="Telerik.Web.UI.DialogHandler.aspx" type="Telerik.Web.UI.DialogHandler" verb="*" preCondition="integratedMode" />
    <add name="Telerik_RadUploadProgressHandler_ashx" path="Telerik.RadUploadProgressHandler.ashx" type="Telerik.Web.UI.RadUploadProgressHandler" verb="*" preCondition="integratedMode" />
  </handlers>
 
</system.webServer>
Ves
Telerik team
 answered on 09 May 2013
1 answer
94 views

We have an issue with RadTreeView node text not displaying correctly after a postback if a folder was expanded using ServerSideCallBack after the control was initially bound. In these scenarios any internal nodes that contain HTML formatting in text lose that HTML formatting. PersistLoadOnDemandNodes is set to True.

Specifically, what we have observed is that if  text of a node that was loaded on demand contains HTML (i.e.

node.text = "My Node Text <span class='NewItem'>-New</span>";

) then upon postbacks the node stays expanded, however the text of internal nodes looses all HTML formatting and plain text is displayed. Any nodes that were loaded as expanded on the initial load show correctly and retain internal HTML formatting, only the nodes that were expanded on demand lose their HTML formatting. Is there a workaround to this issue?

Thanks,
Albert

Kate
Telerik team
 answered on 09 May 2013
1 answer
129 views
I'm guessing the RadChart defaults to a cluster bar chart since that's the way it appears in the documentation. I need just need one bar per my data segments. My data is simply a name column and a value. Where am I going wrong here?


 <telerik:RadChart runat="server" ID="rcData" DefaultType="Bar" DataSourceID="sdsData" 
               SeriesOrientation="Horizontal" Width="500px" Height="600px">
              <PlotArea>
                 <XAxis Appearance-ValueFormat="General" DataLabelsColumn="Name"></XAxis>
               </PlotArea>
                <Legend Visible="false"></Legend>
                <ChartTitle Visible="false"></ChartTitle>
             </telerik:RadChart>
Evgenia
Telerik team
 answered on 09 May 2013
1 answer
107 views
This code work before upgrade from 2012.3.1016.40 to 2013.1.417.40. Now the RadAjaxManager1_AjaxRequest fired before I click at Ok button. When click at 'Button1' the request is fired. I rerturn to 2012.3.1016.40 and the problem continue. Any idea ?

Default.aspx
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="cPanel_Default" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<head runat="server">
    <title></title>
</head>
 
<body>
    <form id="form1" runat="server">
    <div>
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        </telerik:RadScriptManager>
 
        <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
            <script type="text/javascript">
                function confirmCallBackFn(arg) {
                    var ajaxManager = $find("<%= RadAjaxManager1.ClientID %>");
                    ajaxManager.ajaxRequest(arg);
                    return false;
                }
            </script>
        </telerik:RadCodeBlock>
 
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="Button1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
 
        <telerik:RadWindowManager ID="RadWindowsManager1" runat="server" Title="Editar" Behaviors="Close,Move" VisibleStatusbar="false" style="z-index:90000" EnableEmbeddedSkins="false" ShowContentDuringLoad="true" ReloadOnShow="true" DestroyOnClose="true" >
        </telerik:RadWindowManager>
 
        <asp:button ID="Button1" runat="server" text="Button" />
    </div>
    </form>
</body>
</html>

Default.aspx.vb
Partial Class cPanel_Default
    Inherits System.Web.UI.Page
 
    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
 
        RadWindowsManager1.RadConfirm("Callback ?", "confirmCallBackFn('Ok')", 300, 120, Nothing, "Test")
 
    End Sub
 
    Protected Sub RadAjaxManager1_AjaxRequest(ByVal sender As Object, ByVal e As Telerik.Web.UI.AjaxRequestEventArgs) Handles RadAjaxManager1.AjaxRequest
 
        If e.Argument = "Ok" Then Button1.Text = e.Argument
 
    End Sub
End Class

Thanks
Paulo
Paulo Goncalves
Top achievements
Rank 2
 answered on 09 May 2013
2 answers
896 views
for simplicity's sake, i would like to call the same javascript function upon the onclientselectedindexchanged event of all the radComboBoxes in my radgrid's popup user control and run some code if the selected item's text = "OTHER". the function is displayed below:
function OnClientSelectedIndexChanged(sender, eventArgs) {
    var item = eventArgs.get_item()
 
    if (item.get_text() == 'OTHER') {
        alert(sender.get_id())       
    }
}

sender.get_id() returns results like:

ctl00_ContentPlaceHolder1_RadGridProductionOrders_ctl00_ctl06_Detail10_ctl05_EditFormControl_RadComboBoxTitleCoverStamping


how can i get just the "RadComboBox_XXX" portion of the result from get_id(), or do i have to use some other method?


Alex
Top achievements
Rank 2
 answered on 09 May 2013
14 answers
199 views
Shouldn't the scheduler retain the sorting of the datasource that's bound to it?

It does not seem to be doing this.  I sort a list, bind it to to the scheduler resource types, and it appears to ignore the order of items in the list.

I have about 7 columns in the resources, so it's important for the user to be able to sort those.
Marbry
Top achievements
Rank 1
 answered on 09 May 2013
1 answer
91 views
Hello,

    I want to highlight todays date in radgrid datetime filter. How can I have this done.

thank you
RT
Shinu
Top achievements
Rank 2
 answered on 09 May 2013
6 answers
211 views
I have a radgrid as in image. I uses Sunset as skin. Its header and rowstyles color not in full height of the row.

<telerik:RadGrid ID="rgGoodsOutwards" runat="server" AllowFilteringByColumn="false"
                                            AllowPaging="false" AutoGenerateColumns="False" BackColor="#FFFFF8" BorderStyle="Solid"
                                            CellPadding="0" GridLines="Both" Skin="Sunset" TabIndex="7" Width="98%" Height="320px" >
                                            <AlternatingItemStyle BackColor="AntiqueWhite" Height="30px" />
                                            <MasterTableView PagerStyle-AlwaysVisible="true" Width="100%" HeaderStyle-ForeColor="White"
                                                HeaderStyle-BackColor="White"  ItemStyle-Height="30px">

Please help.


Venelin
Telerik team
 answered on 09 May 2013
1 answer
70 views
Hi there,
     How can I give header for clientselect column.
thanks in advance
Savyo

Shinu
Top achievements
Rank 2
 answered on 09 May 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?