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

Opening the New Appointment form and Pre-populating fields

1 Answer 122 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Anthony
Top achievements
Rank 1
Anthony asked on 06 Oct 2010, 01:52 PM
Hi Telerik Team,

I'm new to AJAX, javascript and especially the RadScheduler and need to know how to achieve the following functionality (or at least to be pointed in the right direction):

1. User clicks a button on the page.
2. The rad scheduler's advanced new appointment form appears in a modal popup, with the subject, description and custom fields pre-populated with data captured from elsewhere in the form.

Many thanks in advance.

1 Answer, 1 is accepted

Sort by
0
Veronica
Telerik team
answered on 13 Oct 2010, 08:44 AM
Hello Anthony,

Please accept my apologies for the late reply.

The solution is similar to this help topic. You need to subscribe to the OnClientTimeSlotClick and use the showAllDayInlineInsertForm method. Here's the code:

Javascript:
Copy Code
function insertAppointment() {
            var now = new Date();
            var scheduler = $find("<%= RadScheduler1.ClientID %>");
            scheduler.showAllDayInlineInsertForm(now);
        }

ASPX:
Copy Code
<input type="button" name="button1" value="Create Appointment" onclick="insertAppointment()" />

To open the Advanced Form without the appearance of the inline form you should set the StartInsertingInAdvancedForm="true". To be able to prepopulate the fields of the Advanced Form - subscibe to the OnFormCreated server-side event and find the controls that wrap the fields. Here's a sample code for Subject and Description fields:

C#:
protected void RadScheduler1_FormCreated(object sender, SchedulerFormCreatedEventArgs e)
    {
        RadTextBox txtSubject = e.Container.FindControl("Subject") as RadTextBox;
        txtSubject.Text = "Modified subject:";
        RadTextBox txtDescription = e.Container.FindControl("Description") as RadTextBox;
        txtDescription.Text = "Some description here";
    }

Find the full code in the attached .zip file.

Hope this helps.

Best Regards,
Veronica MIlcheva
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Scheduler
Asked by
Anthony
Top achievements
Rank 1
Answers by
Veronica
Telerik team
Share this question
or