Help to set Gauge pointer Value in code behind

5 posts, 1 answers
  1. Gustavo
    Gustavo avatar
    23 posts
    Member since:
    Apr 2012

    Posted 14 Dec 2012 Link to this post

    Hi Telerik Team, I have this gauge

    <telerik:RadRadialGauge runat="server" ID="RadRadialGauge1" Width="300px" Height="300px">
         <Pointer Value="10">
              <Cap Size="0.1" />
         </Pointer>
         <Scale Min="0" Max="100" MajorUnit="10"/>
    </telerik:RadRadialGauge>

    I'm changing the pointer value in the code behind with this command:
    RadRadialGauge1.Pointer.Value = 50;

    The initial value of the pointer is 10, but when I call the command to set the value to 50, the pointer goes to zero and than after goes to 50.
    I want that the pointer begin in 10 and go immediately to 50.

    Thanks,
    Gustavo

  2. Answer
    Danail Vasilev
    Admin
    Danail Vasilev avatar
    1493 posts

    Posted 15 Dec 2012 Link to this post

    Hi Gustavo,

    When you dispose the control when it renders it plays this animation (the pointer moving from 0 to the designated value). If you want to avoid this behavior you should avoid disposing the control and you should use its client-side API instead: http://www.telerik.com/help/aspnet-ajax/gauge-client-side-api.html.


    You can store the desired value in a hidden field and execute a script when the page is loaded that will read the hidden input and set the value. This help article explains how you can execute a script from the code-behind. Note the Sys.Application.add_load() approach. If you have a handler that will be executed at every load you will not need to call the script from the server.

    For your convenience I am attaching here a simple page that shows how this can be done.

    Greetings,
    Danail Vasilev
    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. UI for ASP.NET Ajax is Ready for VS 2017
  4. Rafael
    Rafael avatar
    15 posts
    Member since:
    Jun 2013

    Posted 06 Aug 2015 in reply to Danail Vasilev Link to this post

    When you dispose the control when it renders it plays this animation (the pointer moving from 0 to the designated value). If you want to avoid this behavior you should avoid disposing the control and you should use its client-side API instead: http://www.telerik.com/help/aspnet-ajax/gauge-client-side-api.html.

    Hi Danail,

    could you explain how to avoid this behavior that you said, please?

    I would like that the RadRadialGauge show the same effect explained by Gustavo, reproducing the transition from the current value to new value like a car velocimeter.

    I found this link: Dispose your client objects, but I don't know if this way is the correct way to do what I want.

     

     

  5. Danail Vasilev
    Admin
    Danail Vasilev avatar
    1493 posts

    Posted 11 Aug 2015 Link to this post

    Hi Rafael,

    You can find a fully runnable example on the matter in the attachment of my previous post. For your convenience I am providing it here too - http://www.telerik.com/clientsfiles/16fb5206-ba05-4386-9fba-c6f62de443fb_ChangeGaugeValueOnTheClient.zip?sfvrsn=0

    Regards,
    Danail Vasilev
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  6. Rafael
    Rafael avatar
    15 posts
    Member since:
    Jun 2013

    Posted 13 Aug 2015 in reply to Danail Vasilev Link to this post

    Thanks Danail,

     

    Works!

Back to Top
UI for ASP.NET Ajax is Ready for VS 2017