This is a migrated thread and some comments may be shown as answers.

Help to set Gauge pointer Value in code behind

4 Answers 136 Views
Gauge
This is a migrated thread and some comments may be shown as answers.
Gustavo
Top achievements
Rank 1
Gustavo asked on 14 Dec 2012, 01:37 PM
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

4 Answers, 1 is accepted

Sort by
0
Accepted
Danail Vasilev
Telerik team
answered on 15 Dec 2012, 03:34 PM
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.
0
Rafael
Top achievements
Rank 1
answered on 06 Aug 2015, 08:45 PM

[quote]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.[/quote]

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.

 

 

0
Danail Vasilev
Telerik team
answered on 11 Aug 2015, 10:43 AM
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
0
Rafael
Top achievements
Rank 1
answered on 13 Aug 2015, 08:49 PM

Thanks Danail,

 

Works!

Tags
Gauge
Asked by
Gustavo
Top achievements
Rank 1
Answers by
Danail Vasilev
Telerik team
Rafael
Top achievements
Rank 1
Share this question
or