I am attempting to use the method outlined in this article to access controls defined in an InPlace editor, but have thus far not been able to get it to work. What I'd like to do is to use the value from one RadDatePicker to populate another RadDatePicker. The <script> block appears as it should but, when the event handler is called, the variables are both null.
ASP.Net:
JavaScript:
ASP.Net:
<
EditItemTemplate
>
<
telerik:RadDatePicker
runat
=
"server"
ID
=
"txtBidDepartDate"
Width
=
"90px"
DateInput-DateFormat
=
"ddMMMyy"
ClientEvents-OnDateSelected
=
"setBidDate"
SelectedDate='<%# (Eval("departtime").ToString().Length > 0) ? DateTime.Parse(Eval("departtime").ToString()) : DateTime.Now %>' />
<
telerik:RadMaskedTextBox
runat
=
"server"
ID
=
"txtBidDepartTime"
Width
=
"45px"
Mask
=
"##:##"
Style
=
"text-align:center;"
Text='<%# (Eval("departtime").ToString().Length > 0) ? DateTime.Parse(Eval("departtime").ToString()).ToString("HH:mm") : "" %>' />
<
asp:RequiredFieldValidator
runat
=
"server"
ID
=
"validateTxtBidDepartDate"
ControlToValidate
=
"txtBidDepartDate"
EnableClientScript
=
"true"
ErrorMessage
=
"Departure Date is required."
ValidationGroup
=
"gridBids"
Display
=
"Dynamic"
/>
<
script
language
=
"javascript"
type
=
"text/javascript"
>
departDateObj = $find('<%# Container.FindControl("txtBidDepartDate").ClientID %>');
</
script
>
</
EditItemTemplate
>
JavaScript:
var
departDateObj,arriveDateObj;
function
setBidDate (sender, args) {
if
(!departDateObj || !arriveDateObj)
return
false
;
if
(!arriveDateObj.isEmpty())
return
false
;
arriveDateObj.set_selectedDate(departDateObj.get_selectedDate());
}