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

Accessing Selected Information when triggering ShowAdvancedInsertForm

2 Answers 65 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Dave
Top achievements
Rank 2
Dave asked on 08 Feb 2010, 12:29 PM
Hello,

We are looking to access selected scheduler resource "code-behind" when launching a "ShowAdvancedInsertForm".
Is there a method to get the scheduler resource grouped by and injecting it to the Advanced Insert form in Q2_2009 version?

Let's say I have a timeline with 3 rooms grouped by and 5 (open) days slots, how can I preselect in the Advanced form the resource "room x" I selected in day d when triggering the "ShowAdvancedInsertForm" by contextual menu?

Regards,
David

2 Answers, 1 is accepted

Sort by
0
robertw102
Top achievements
Rank 1
answered on 08 Feb 2010, 05:45 PM
I'm guessing you can use the FormCreated event. You just need to check the form mode "e.Container.Mode == SchedulerFormMode.AdvancedInsert" and then access the controls you want to preselect. You even have access to the appointment object. I don't know if the appointment object will know the resource you selected, but you can check it I guess.

I hope that helps.
0
T. Tsonev
Telerik team
answered on 10 Feb 2010, 09:46 AM
Hello,

The suggestion that Robert made is valid. For example:
protected void RadScheduler1_FormCreated(object sender, SchedulerFormCreatedEventArgs e)
{
    if (e.Container.Mode == SchedulerFormMode.AdvancedInsert)
    {
        RadComboBox room = e.Container.FindControl("ResUser") as RadComboBox; // Res + resource name
        if (room != null)
        {
            // ...
        }
    }
}

You can also assign a resource in the FormCreating event and it will be selected automatically:

protected void RadScheduler1_FormCreating(object sender, SchedulerFormCreatingEventArgs e)
{
    if (e.Mode == SchedulerFormMode.AdvancedInsert)
    {
        Resource room1 = RadScheduler1.Resources.GetResource("Room", 1);
        e.Appointment.Resources.Add(room1);
    }
}

I hope this helps.

All the best,
Tsvetomir Tsonev
the Telerik team

Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
Tags
Scheduler
Asked by
Dave
Top achievements
Rank 2
Answers by
robertw102
Top achievements
Rank 1
T. Tsonev
Telerik team
Share this question
or