Hi,
I want to set "End by" date on pageload to next month's day. How can I do that?
Thanks,
Mangesh
I want to set "End by" date on pageload to next month's day. How can I do that?
Thanks,
Mangesh
3 Answers, 1 is accepted
0
Princy
Top achievements
Rank 2
answered on 11 Sep 2012, 04:53 AM
Hi Mangesh,
Try the following code snippet to achieve your scenario.
ASPX:
C#:
Hope this helps.
Regards,
Princy.
Try the following code snippet to achieve your scenario.
ASPX:
<
telerik:RadSchedulerRecurrenceEditor
ID
=
"RadSchedulerRecurrenceEditor1"
runat
=
"server"
>
</
telerik:RadSchedulerRecurrenceEditor
>
C#:
protected
void
Page_Load(
object
sender, EventArgs e)
{
((RadDatePicker)(RadSchedulerRecurrenceEditor1.FindControl(
"RangeEndDate"
))).SelectedDate = (DateTime.Now.AddMonths(1));
}
Hope this helps.
Regards,
Princy.
0
Mangesh
Top achievements
Rank 1
answered on 11 Sep 2012, 11:05 AM
Hi Princy,
Thanks for the code but unfortunately it didn't work in my scenario.
I checked the value of $('#RadSchedulerRecurrenceEditor1_RangeEndDate_dateInput') after setting to the next month and in Mozilla debugger it is clearly showing next month's value, however in the End Day input box, it is still showing current date.
I have attached the screenshots.
I also checked for any other JavaScript error in console but there were no error.
-
Mangesh
Thanks for the code but unfortunately it didn't work in my scenario.
I checked the value of $('#RadSchedulerRecurrenceEditor1_RangeEndDate_dateInput') after setting to the next month and in Mozilla debugger it is clearly showing next month's value, however in the End Day input box, it is still showing current date.
I have attached the screenshots.
I also checked for any other JavaScript error in console but there were no error.
-
Mangesh
0
Hello,
I suggest you to use the OnClientFormCreated client-side event instead of server-side events to modify the Advanced Form. Here you can find more information about customizing the Advanced From using jQuery and css. Here below I am providing an implementation of your desired functionality:
//aspx
//JavaScript
Kind regards,
Boyan Dimitrov
the Telerik team
I suggest you to use the OnClientFormCreated client-side event instead of server-side events to modify the Advanced Form. Here you can find more information about customizing the Advanced From using jQuery and css. Here below I am providing an implementation of your desired functionality:
//aspx
<
telerik:RadScheduler
runat
=
"server"
ID
=
"RadScheduler1"
AdvancedForm-Modal
=
"true"
OnClientFormCreated
=
"OnClientFormCreated"
>
</
telerik:RadScheduler
>
//JavaScript
function
OnClientFormCreated(sender, args) {
var
$ = $telerik.$;
var
mode = args.get_mode();
if
(mode == Telerik.Web.UI.SchedulerFormMode.AdvancedInsert || mode == Telerik.Web.UI.SchedulerFormMode.AdvancedEdit) {
var
recurrenceEditorJqueryObj = $(
"[id$='RangeEndDate']"
);
var
recurrenceEditor = $find(recurrenceEditorJqueryObj.attr(
"id"
));
var
today =
new
Date();
today.setMonth(today.getMonth() + 1);
recurrenceEditor.set_selectedDate(today);
}
}
Kind regards,
Boyan Dimitrov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.