Accessing Selected Information when triggering ShowAdvancedInsertForm

3 posts, 0 answers
  1. Dave
    Dave avatar
    25 posts
    Member since:
    Aug 2012

    Posted 08 Feb 2010 Link to this post

    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. robertw102
    robertw102 avatar
    265 posts
    Member since:
    Jul 2007

    Posted 08 Feb 2010 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. T. Tsonev
    Admin
    T. Tsonev avatar
    2772 posts

    Posted 10 Feb 2010 Link to this post

    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.
Back to Top