getElementPosition() JS Error

6 posts, 1 answers
  1. Rob
    Rob avatar
    115 posts
    Member since:
    Aug 2012

    Posted 13 Aug 2014 Link to this post

    I just recently upgraded from Q3 2011 to Q1 2014 and some previously working javascript code for the RadDatePicker control is now broken.  Please see attached screenshot for error in the debugger.  Can you explain either what has changed for this method or the new way of doing things?  Looking at your documentation, this method should still exist.  Both the datePicker & textBox variables are instantiated objects.

    Please advise.

    Thanks,
    Rob
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 14 Aug 2014 in reply to Rob Link to this post

    Hi Rob,

    Please try to use getPosition instead of getElementPosition. Please have a look into this forum thread which I have answered for the same requirement.

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Rob
    Rob avatar
    115 posts
    Member since:
    Aug 2012

    Posted 14 Aug 2014 Link to this post

    Thank you for your response and workaround, Shinu!

    Now I'm running into a similar situation with datePicker.getElementDimensions() not existing. 

    Do you have a similar workaround?
  5. Answer
    Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 17 Aug 2014 in reply to Rob Link to this post

    Hi Rob,

    I guess you want to get the width and height of the container. Please try the below code snippet to get the height and width of textbox in RadDateTimePicker.

    JavaScript:
    ...
    var
    TimePicker = $find("<%=RadDateTimePicker.ClientID %>");
    var textBox = TimePicker.get_textBox();
    alert(textBox.offsetHeight);
    alert(textBox.offsetWidth);
    ...

    Thanks,
    Shinu.
  6. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    1793 posts

    Posted 18 Aug 2014 Link to this post

    Hello Rob,

    Due to some issues with the previous method and for unification purposes, the getElementPosition() method was removed and the getLocation() method exposed in the Telerik.Web.CommonScripts.getLocation() method should be used instead:
    Telerik.Web.CommonScripts.getLocation($find("datePicker1").get_element())

    The same applies to the getElementDimension() method, which is now available in the Telerik.Web.UI.Calendar.Utils:
    Telerik.Web.UI.Calendar.Utils.GetElementDimensions($find("datePicker1").get_element())

    I have noticed that there are still some topics in our documentation referring to the old methods and I will make sure that they are be changed accordingly. 

    Please excuse us for any inconvenience caused by those changes.


    Regards,
    Konstantin Dikov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  7. Rob
    Rob avatar
    115 posts
    Member since:
    Aug 2012

    Posted 19 Aug 2014 Link to this post

    Thank you both for your responses, but Shinu's suggestions worked for me.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017