Block Slider Auto Postback

2 posts, 0 answers
  1. Yuri Kovalenko
    Yuri Kovalenko avatar
    1 posts
    Member since:
    Oct 2008

    Posted 04 Feb 2009 Link to this post

    I have slider with AutoPostBack property set to "true". How can I block auto postback when changing value of a slider with the client side API? E. g. I don't need postback to fire when running this code:
    At the same time I need postback to fire when I change value of a slider by Drag Handle.
  2. Tsvetie
    Tsvetie avatar
    1517 posts

    Posted 09 Feb 2009 Link to this post

    Hello Yuri,
    You cannot block the postback using the client-side API of the RadSlider. You can only cancel the ValueChange operation using the OnClientBeforeValueChange handler. Basically, in this case, you can think of the RadSlider as of a simple ASP Button. You can block the postback of the slider the same way you can block the postback of a Button when a certain condition is met.

    For example:
    <script type="text/javascript"
    var toPostBack = true
    function OnClientValueChange(sender, args) 
            __doPostBack('<%= RadSlider1.ClientID %>'); 
            toPostBack = true
    function ChangeValueWithCode() 
        var slider = $find('<%= RadSlider1.ClientID %>'); 
        toPostBack = false
    <asp:Label ID="slValue" runat="server"></asp:Label> 
    <telerik:RadSlider ID="RadSlider1" runat="server" 
    <button onclick="ChangeValueWithCode(); return false;">No PostBack</button> 

    protected void RadSlider1_ValueChanged(object sender, EventArgs e) 
        slValue.Text = RadSlider1.Value.ToString(); 

    Best wishes,
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top