Setting isSelectionRangeEnabled on Client-Side

5 posts, 1 answers
  1. Jason
    Jason avatar
    18 posts
    Member since:
    Aug 2013

    Posted 17 Oct 2013 Link to this post

    I have an issue setting isSelectionRangeEnabled on the client-side 

    I have a dropdownlist and a slider,  When the ddl has a value of 3 I want to make sure selection range is turned on.

    function operatorChanged() {
        var slider = $find('<%= slideNewRating.ClientID %>');
        var ddlOperators = document.getElementById("<%=ddlOperators.ClientID%>");
        var value = ddlOperators.options[ddlOperators.selectedIndex].value;
        if (value == 3) {
            slider.set_isSelectionRangeEnabled(true);
            slider.set_selectionStart = 1;
            slider.set_selectionEnd = 3;
        }
        else
            slider.set_isSelectionRangeEnabled(false);
                     
    }

    This works fine on my page.  The slider instantly changes from a single value selection to a range.

    My problem is after postback and trying to obtain the slider range values to use in C# to send them to the database.
    I can move the 2 sliders all over track but on posting and setting breakpoint in my code i find; The isSelectionRangeEnabled value shows as true, but SelectionEnd and SelectionStart values are always 0 and the Value property is equal to what the SelectionStart value should be.

    Even when I explicitly set the selection range like in my code above this occurs.  Its like the control gets half set into different selection modes from the client-side.

    Thoughts?
  2. Answer
    Slav
    Admin
    Slav avatar
    1355 posts

    Posted 18 Oct 2013 Link to this post

    Hello Jason,

    Please note that set_selectionEnd and set_selectionStart are functions and the new values should be passed as parameters. Also, it is recommended to set the selection end value first, otherwise the end selection will be updated twice and the starting value will not be applied. The following code sample demonstrates this:
    slider.set_selectionEnd(70);
    slider.set_selectionStart(30);

    Regards,
    Slav
    Telerik
    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 the blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Jason
    Jason avatar
    18 posts
    Member since:
    Aug 2013

    Posted 18 Oct 2013 Link to this post

    ah, bad javascript code.  So it does like you do have to set some sort of value first.  IM trying this out now, but one more question...

    Is there a client-side equivalent of server side .SelectedRegionStartValue?  I dont see it here http://www.telerik.com/help/aspnet-ajax/slider-client-object.html
  5. Slav
    Admin
    Slav avatar
    1355 posts

    Posted 18 Oct 2013 Link to this post

    Hello Jason,

    This property is not exposed in the client-side object of the RadSlider and currently it can be configured only on the server-side. You can post a feature request for creating a function that will set it on the client in our Feedback portal.

    It is an option to use an AJAX request for dynamically changing this setting, if it is required in your project.

    Regards,
    Slav
    Telerik
    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 the blog feed now.
  6. Jason
    Jason avatar
    18 posts
    Member since:
    Aug 2013

    Posted 18 Oct 2013 Link to this post

    I was already on my way doing exactly that just in case it wasn't available, sometimes things are missing from the documentation and I stumble across them in Google search results.  Thank you again for your help Slav!
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017