Slider and Masterpage

3 posts, 0 answers
  1. Mikko
    Mikko avatar
    23 posts
    Member since:
    Jun 2012

    Posted 15 Oct 2019 Link to this post

    When using Masterpage, I cannot read value from the Slider or move slider. Without Masterpage everything is working fine.

    Radslider:

    <telerik:RadSlider RenderMode="Lightweight" ID="RadSlider_Items"
         runat="server" Value="100" ItemType="item" Width="790px"
         SmallChange="1" OnClientValueChanged="onSliderValueChanged"
         Height="70px" AnimationDuration="400" ShowDragHandle="true"
         MaximumValue="300" MinimumValue="50" ThumbsInteractionMode="Free">
         </telerik:RadSlider>

    Javascript error:

    Cannot read property 'get_value' of null

    Javascript code:

    function onSliderValueChanged(sender, args) {


                    var slider = $find('ContentPlaceHolder1_RadSlider_Items');
                    var sliderValue = slider.get_value;

                    var imageControl = $find('ContentPlaceHolder1_RadImageEditor1');
                    imageControl.zoomImage(sliderValue);

                }

  2. Mikko
    Mikko avatar
    23 posts
    Member since:
    Jun 2012

    Posted 17 Oct 2019 in reply to Mikko Link to this post

    We found a solution for this. When using Masterpage we are now using

     function onSliderValueChanged(sender, args) {

                    var sliderValue = sender.get_value();
                    var imageControl = $telerik.findControl(document.documentElement, "RadImageEditor1");
                    imageControl.zoomImage(sliderValue);

                }

  3. Vessy
    Admin
    Vessy avatar
    2211 posts

    Posted 17 Oct 2019 Link to this post

    Hi,

    Thank you for the update, Mikko. Another option you can consider is referring the ImageEditor directly by its ClientID like follows (note that the script has to be placed directly on the aspx page, but not an external js file):

                function onSliderValueChanged(slider, args) {
                    var sliderValue = slider.get_value;
    
                    var imageControl = $find('<%=RadImageEditor1.ClientID%>');
                    imageControl.zoomImage(sliderValue);
                }

    Regards,
    Vessy
    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top