RadChart Resizing OnLoad

Thread is closed for posting
3 posts, 0 answers
  1. Jocelyn
    Jocelyn avatar
    148 posts
    Member since:
    Jul 2012

    Posted 12 Mar 2012 Link to this post


    I am trying to resize my chart when the page load. Here is the code I have right now:

    function ResizeChart()
        var ajaxManager = $find("<%= RadAjaxManager1.ClientID %>");
        var arg1 = $(document).width();
        var arg2 = 305;
        ajaxManager.ajaxRequest(arg1 + "," + arg2);

    Protected Sub RadAjaxManager1_AjaxRequest(ByVal sender As Object, ByVal e As Telerik.Web.UI.AjaxRequestEventArgs) Handles RadAjaxManager1.AjaxRequest
        Dim argument As String = e.Argument
        Dim sArray As String() = argument.Split(",".ToCharArray())
        chartLabos.Width = CInt(sArray(0))
        chartLabos.Height = CInt(sArray(1))
    End Sub

    ResizeChart() is called on the onresize event on the Body and it works! But when it's called with the jQuery "$(document).ready" my variable ajaxManager is null, so I understand that the RadAjaxManager is not loaded at this time. How can I call ResizeChart() on the load of the RadChart? I can't find any ClientEvent for the RadChart.

  2. Petar Marchev
    Petar Marchev avatar
    996 posts

    Posted 15 Mar 2012 Link to this post

    Hi Jocelyn,

    I have attached a project that demonstrates how to resize the chart  on page load. The resizing does not actually take place in pageLoad, but in OnClientLoad of a RadSplitter (which parents the chart).

    I hope that the proposed approach is applicable for your current project.  

    Petar Marchev
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. Jocelyn
    Jocelyn avatar
    148 posts
    Member since:
    Jul 2012

    Posted 16 Mar 2012 Link to this post

    Thanks Petar. I found a simple an easy way to achieve this:


    Works very well.
Back to Top