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

"object required" error

2 Answers 25 Views
Slider
This is a migrated thread and some comments may be shown as answers.
Jessie
Top achievements
Rank 1
Jessie asked on 11 Aug 2009, 04:33 AM
Hi,

    I am trying the example of RadSlider for ASP.NET AJAX - First Look using VS2008 and IE7. 

    When I put the coding inside the Content, I get a javascript error "object required" as below:

    Anyone know how to solve this problem? Thanks in advance for the help.

   <
asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

    <asp:ScriptManager id="ScriptManager" runat="server" />
    
            <script type="text/javascript">
                function ZoomImage(sender, eventArgs)
                {
                    var sliderValue = sender.get_value();
                    var img = $get("img_preview");
                    var imageHeight = 212;
                    
                    

                //Error: object required
                img.style.height = sliderValue/150 * imageHeight + "px";

                }
            </script>
            <img src="Images/top.gif" alt="" style="display:block;"/><div style="background:white;float:left;width:412px;height:280px;overflow:auto;"><img id="img_preview" src="Images/pic.gif" alt=""/></div><div style="float:left;background-image:url(Images/SliderBckg.gif);height:280px;background-repeat:no-repeat;width:87px;padding-top:5px;padding-left:31px;">
            <telerik:RadSlider ID="zoomSlider" runat="server"                 
                Value="150"
                MaximumValue="250"
                MinimumValue="50"
                OnClientValueChange="ZoomImage"
                Orientation="Vertical"
                Length="206"
                ShowDecreaseHandle="false"
                ShowIncreaseHandle="false"
            />
            </div>

 

</

 

asp:Content>

 

 

 

 

2 Answers, 1 is accepted

Sort by
0
Svetlina Anati
Telerik team
answered on 11 Aug 2009, 01:17 PM
Hi Jessie,

I built up a test demo based on your code but unfortunately to no avail - I was not able to reproduce the error you describe. I tested the demo both with the 2009.1.402 version as you noted and also with the latest build but no error was thrown. Would you please examine the attached test demo and let me know whether I am missing something? Once I am able to observe the problem locally I will do my best to help. 

Kind regards,
Svetlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Jessie
Top achievements
Rank 1
answered on 12 Aug 2009, 02:09 AM
Hi Svetlina,

    Thanks for your reply. 

    I already solve the problem by myself.

    I just change var img = $get("img_preview");
    to var img = document.getElementById("<%=img_preview.ClientID%>");

    Then, the slider can be zoom in and zoom out already. Thanks.
Tags
Slider
Asked by
Jessie
Top achievements
Rank 1
Answers by
Svetlina Anati
Telerik team
Jessie
Top achievements
Rank 1
Share this question
or