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

Set "End by" on pageload

3 Answers 56 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Mangesh
Top achievements
Rank 1
Mangesh asked on 10 Sep 2012, 08:49 PM
Hi,

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

Sort by
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:
<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
0
Boyan Dimitrov
Telerik team
answered on 11 Sep 2012, 01:04 PM
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

<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.
Tags
Scheduler
Asked by
Mangesh
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Mangesh
Top achievements
Rank 1
Boyan Dimitrov
Telerik team
Share this question
or