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

Slider and Masterpage

2 Answers 45 Views
Slider
This is a migrated thread and some comments may be shown as answers.
Mikko
Top achievements
Rank 1
Veteran
Mikko asked on 15 Oct 2019, 12:17 PM

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 Answers, 1 is accepted

Sort by
0
Mikko
Top achievements
Rank 1
Veteran
answered on 17 Oct 2019, 08:45 AM

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);

            }

0
Vessy
Telerik team
answered on 17 Oct 2019, 02:16 PM

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.
Tags
Slider
Asked by
Mikko
Top achievements
Rank 1
Veteran
Answers by
Mikko
Top achievements
Rank 1
Veteran
Vessy
Telerik team
Share this question
or