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

find RadDatePicker within a div

2 Answers 137 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Suchitra
Top achievements
Rank 1
Suchitra asked on 02 Jun 2014, 11:54 AM
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 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 03 Jun 2014, 04:12 AM
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.
0
Suchitra
Top achievements
Rank 1
answered on 03 Jun 2014, 04:38 AM
Your suggestion worked just fine. Thanks much Shinu.

Thanks
Suchitra
Tags
General Discussions
Asked by
Suchitra
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Suchitra
Top achievements
Rank 1
Share this question
or