I have a page with multiple RadDatePicker controls. For each control, I want the MaxDate to be the current date. So I created a Javascript method to set this. This is working fine. However, I don't wnat to have to create a unique Javascript method for each individual RadDatePicker to call.
Does anyone know a work-around for this situation? (I definately don't know my way around Javascript). Is there a way I can pass as a parameter the ID of the particular RadDatePicker control, and use the parameter variable to find that control on the page?
Function to set the max date of my RadDatePicker:
Does anyone know a work-around for this situation? (I definately don't know my way around Javascript). Is there a way I can pass as a parameter the ID of the particular RadDatePicker control, and use the parameter variable to find that control on the page?
Function to set the max date of my RadDatePicker:
function RadDatePicker_SetMaxDateToCurrentDate() { |
var datePicker = $find("<%= txtTest.ClientID %>"); |
datePicker.set_maxDate(new Date()); |
}; |
One of many RadDatePicker controls on my page:
<telerik:RadDatePicker ID="txtTest" runat="server" MinDate="1900-01-01" > |
<DateInput ID="DateInput2" DateFormat="MMMM yyyy" runat="server" ReadOnly="true"> |
</DateInput> |
<Calendar ID="CalendarInput2" runat="server"> |
<SpecialDays> |
<telerik:RadCalendarDay repeatable="Today" Date="" ItemStyle-CssClass="rcToday" /> |
</SpecialDays> |
<ClientEvents OnLoad="RadDatePicker_SetMaxDateToCurrentDate" /> |
</Calendar> |
</telerik:RadDatePicker> |