set_Value invokes OnClientValueChange twice

3 posts, 0 answers
  1. grnbeagle
    grnbeagle avatar
    9 posts
    Member since:
    Jun 2007

    Posted 24 Sep 2007 Link to this post

    Hi,

    It looks like when I call slider.set_Value(#), the client-side callback function (defined in OnClientValueChange) gets invoked twice. Is there a workaround to this?

    Thanks,
    Amie
  2. Tsvetie
    Admin
    Tsvetie avatar
    1517 posts

    Posted 26 Sep 2007 Link to this post

    Hello grnbeagle,
    I added this issue to our TODO list and updated your Telerik points for the report.

    For the time being, you can use the following workaround:
    <body> 
        <script type="text/javascript">  
        var currentValue;  
          
        function Test()  
        {  
            var slider = $find('<%= RadSlider1.ClientID %>');  
              
            //Before you use the get_Value method, assign the value of the slider to a global variable.  
            currentValue = slider.get_Value();  
            slider.set_Value(5);  
        }  
          
        function OnClientValueChangeHandler(sender, eventArgs)  
        {  
            var sliderValue = sender.get_Value();  
              
            if(currentValue != sliderValue)  
            {     
                //Execute your code here.           
                alert(sliderValue);  
                  
                //Get the updated slider value.  
                currentValue = sliderValue;  
            }  
        }   
        </script> 
        <form id="form1" runat="server">  
            <asp:ScriptManager ID="ScriptManager1" runat="server" /> 
            <telerik:RadSlider ID="RadSlider1" runat="server"   
                OnClientValueChange="OnClientValueChangeHandler" /> 
            <input type="button" onclick="Test();return false;" value="Test" /> 
        </form>      
    </body> 


    Kind regards,
    Tsvetie
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. grnbeagle
    grnbeagle avatar
    9 posts
    Member since:
    Jun 2007

    Posted 26 Sep 2007 Link to this post

    Cool. That worked for me. Thanks!
Back to Top