find RadDatePicker within a div

3 posts, 0 answers
  1. Suchitra
    Suchitra avatar
    1 posts
    Member since:
    Jun 2014

    Posted 02 Jun 2014 Link to this post

    Hi, how do I get a handle to the RadDatePicker, within the context of a div.
    my code snippet looks like this:
                        <div id="div123">
                          <telerik:RadDatePicker ID="txtSomeDate" runat="server" CausesValidation="True">
                          </telerik:RadDatePicker>
                        </div>

    The command :
    var somedate = $find("<%=txtSomeDate.ClientID %>");
    returns me the datepicker.

    However, I have a requirement where I need to get a handle to this datepicker which is within the div "div123" only.
    This is because I have this datepicker within a user control and this user control could be embedded multiple times in the same page.

    I tried $find("<%=txtSomeDate.ClientID %>",div123) but it returns null.

    Any clues on how to get this working?

    Thanks
    Suchitra
     




  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 02 Jun 2014 in reply to Suchitra Link to this post

    Hi Suchitra,

    In order to achieve your scenario please try to use $get method, which accepts two parameters. The first is the id of the DOM element you want to retrieve and second is the parent element of where the search starts. Please try the below JavaScript which works fine at my end.

    JavaScript:

    var somedate = $get("<%=txtSomeDate.ClientID%>", div123);

    Thanks,
    Shinu.
  3. Suchitra
    Suchitra avatar
    6 posts
    Member since:
    Jun 2014

    Posted 02 Jun 2014 in reply to Shinu Link to this post

    Your suggestion worked just fine. Thanks much Shinu.

    Thanks
    Suchitra
Back to Top