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

Catching events from the advanced form

5 Answers 41 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
IT-Als
Top achievements
Rank 1
IT-Als asked on 18 Aug 2010, 09:09 AM
Hi all,

I am using the Scheduler with my own data provider (data is stored in a database)

Now, I have a need for linking an appointment to a specific customer, project, sales lead, etc.

I was thinking of implementing this on the advanced form with two extra fields:

Link Type, which is a set of Radio Buttons or a Combobox where each item represents the link type (customer, project....)
Linked To, which is a ComboBox where each item represents for example a Customer (if Link Type "Customer" was chosen).

There is obviously a need to catch the item change event of the RadioButton/ComboBox for the LinkType to populate the Linked To ComboBox with the right items.

How do I subscribe to this event in the advanced forms (both create and edit)?  Or are there any other ways of doing this?

Thanks in advance.

Regards

Henrik

5 Answers, 1 is accepted

Sort by
0
Veronica
Telerik team
answered on 18 Aug 2010, 11:10 AM
Hello Henrik,

You'll need to customize the Advanced Form of the RadScheduler to be able to add additional controls.
You can subscribe to events of these controls.

Please taka a look at this help topic and the Knowledge Base article here.

Also you can look at the demo here.

Please let me know if you have further questions.

Sincerely yours,
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
0
IT-Als
Top achievements
Rank 1
answered on 18 Aug 2010, 11:43 AM
Hi Veronica,

Thanks for your fast answer.

Thought the answer was I needed to customize using controls.

Isn't there another way of subscribing to the events... maybe by getting hold of the control runtime at subscribing to the event at runtime in some kind of event... For example the FormCreate?

If not, I will give it a spin with the customization.

Regards

Henrik
0
Veronica
Telerik team
answered on 18 Aug 2010, 04:16 PM
Hello Henrik,

Yes, you can find controls in the OnFormCreated event and then call the events from them.
Here's an example for the "StartDate" RadDatePicker from this help topic:

protected void RadScheduler1_FormCreated(object sender, SchedulerFormCreatedEventArgs e)
{
   RadDatePicker startDate = e.Container.FindControl("StartDate") as RadDatePicker;
   if (startDate != null)
   {
       // advanced form is shown
       startDate.ClientEvents.OnDateSelected = "changeEndDate";
   }
}

The question is how do you plan to add these controls? As they did not occur in the Advanced Form I guess you'll need to customize it.

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
0
IT-Als
Top achievements
Rank 1
answered on 19 Aug 2010, 09:23 AM
Hi Veronica,

I have successfully implemented other ComboBoxes by using a specific ResourceType in my DbProvider, for example for attendees (multiple resources), organizer (single resource), partner (single resource).

My initial idea was to do it the same way having two ResourceType in my provider (LinkType and LinkedTo), both single resource.

However, as the LinkType (Customer, Project, etc.) will have an impact of what resources the comboxbox LinkedTo (specific customer, project, etc) will present in its list of items as I was asking for a way to catch the change of item in the LinkType.

Basically I will do this:

In the provider (on create appointment):

- Load resource types (LinkType resource): Customer, Project, Lead
- Have a resource type (LinkedTo resource) that initially is empty.

When I catch the LinkType_ItemChaged event, I will ask the provider to give me a list of possible LinkedTo resources of the selected LinkType and bind it to the combobox representing the list of available LinkedTo items (for example, customers)

Is the above possible?

Regards

Henrik
0
Veronica
Telerik team
answered on 25 Aug 2010, 11:56 AM
Hello Henrik,

Please accept my apologies for the late answer.

Thank you for the detailed description. The answer is yes.

Here's how this could be done:

As I described in my previous post you can Subscribe to the OnFormCreated event and find the RadComboBox from there. Let's for example test the "Defining Resources" Demo. The ID of the Resource RadComboBox is formed with the name of the resource and prefix "Res". In the demo we have the Room resource. So the ID of the RadComboBox will be "ResRoom". After finding the combobox you can subcribe to the client-side OnClientSelectedIndexChanged and do the needed logic there. Here's the code for this:

C#:
protected void RadScheduler1_FormCreated(object sender, SchedulerFormCreatedEventArgs e)
       {
           RadComboBox combo = e.Container.FindControl("ResRoom") as RadComboBox;
           combo.OnClientSelectedIndexChanged = "selectedIndexChanged";
       }

JavaScript:
<script type="text/javascript">
       function selectedIndexChanged(sender, args) {
           alert("selectedIndexChanged fired!");
       }
   </script>

Hope this helps.

Greetings,
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
IT-Als
Top achievements
Rank 1
Answers by
Veronica
Telerik team
IT-Als
Top achievements
Rank 1
Share this question
or