Hello,
I have gone through the demo's and manual in relation to the Scheduler Advanced Form but I just can't seem to get it working properly.
I am able to create my own custom fields on the form and have them displayed but I can't figure out how to do things such as populate a combo box in the form. I have tried re-using the ResourceControl for the combo boxes but can't work out how to populate them with data.
Does anyone have any step by step instructions for a first time RadScheduler user? I am able to easily get the Scheduler working and populated with data, just can't get the Advanced Form working.
Thanks.
I have gone through the demo's and manual in relation to the Scheduler Advanced Form but I just can't seem to get it working properly.
I am able to create my own custom fields on the form and have them displayed but I can't figure out how to do things such as populate a combo box in the form. I have tried re-using the ResourceControl for the combo boxes but can't work out how to populate them with data.
Does anyone have any step by step instructions for a first time RadScheduler user? I am able to easily get the Scheduler working and populated with data, just can't get the Advanced Form working.
Thanks.
3 Answers, 1 is accepted
0
pucsoftware
Top achievements
Rank 1
answered on 24 Jun 2010, 03:01 PM
I'm not an advanced user of the scheduler but have been trying to do some heavy customization. If you are going to use resources then you have to create your own provider as far as I can tell. You'd want to look at the DbSchedulerProvider example in the LiveExamples. If you look at the MyDbSchedulerProvider.cs you will see this code.
This defines the resource
This code populates the resource
The LoadResources function populates the appointments with the resource. Once you have the resources you can use them. If you look a the AdvancedFormTemplate example now you can see how it is used. First off in the Default.aspx page you need to add the resources to the properties of the scheduler.
Find the CustomAttributeNames="AppointmentColor"
Then you use the AdvancedEditTemplate to set the values. Again see the AppointmentColor='<%# Bind("AppointmentColor") %>'
The rest is done by the AdvancedFormCS.aspx form, which you have to customize with your properties.
The additional User Controls should do the rest.
I've gotten most of this to work in my project. But I am also using custom styles from the App_Themes folder which I think is causing a problem with the javascript. So, I can't say for sure I haven't missed something until I get what I've done working correctly.
Also, last year when I tried using the component I found it very difficult to work with so I had created my own user control that did all this and it worked with the Window component. It was just like working with any other user control. However, doing this did require kinda hacking the way you called it from the scheduler and setting properties to essentially have the scheduler only display the data and that's it. I also have way more control of the css files that are being loaded if done this way. After the latest upgrade I thought I'd give it another shot to do it the way Telerik has done it. But, with all the styling and javascript mess I've encountered it looks like I may go back to my original solution.
Hope this helps.
This defines the resource
private IDictionary<int, Resource> _teachers; |
private IDictionary<int, Resource> Teachers { |
get { |
if (_teachers == null) { |
_teachers = new Dictionary<int, Resource>(); |
foreach (Resource teacher in LoadTeachers()) |
{ |
_teachers.Add((int)teacher.Key, teacher); |
} |
} |
return _teachers; |
} |
} |
This code populates the resource
private IEnumerable<Resource> LoadTeachers() { |
List<Resource> resources = new List<Resource>(); |
using (DbConnection conn = OpenConnection()) { |
DbCommand cmd = DbFactory.CreateCommand(); |
cmd.Connection = conn; |
cmd.CommandText = "SELECT [TeacherID], [Name], [Phone] FROM [DbProvider_Teachers]"; |
using (DbDataReader reader = cmd.ExecuteReader()) { |
while (reader.Read()) { |
Resource res = new Resource(); |
res.Type = "Teacher"; |
res.Key = reader["TeacherID"]; |
res.Text = Convert.ToString(reader["Name"]); |
res.Attributes["Phone"] = Convert.ToString(reader["Phone"]); |
resources.Add(res); |
} |
} |
} |
return resources; |
} |
The LoadResources function populates the appointments with the resource. Once you have the resources you can use them. If you look a the AdvancedFormTemplate example now you can see how it is used. First off in the Default.aspx page you need to add the resources to the properties of the scheduler.
Find the CustomAttributeNames="AppointmentColor"
Then you use the AdvancedEditTemplate to set the values. Again see the AppointmentColor='<%# Bind("AppointmentColor") %>'
The rest is done by the AdvancedFormCS.aspx form, which you have to customize with your properties.
//-- PROPERTY DEFINITION IN .cs |
[Bindable(BindableSupport.Yes, BindingDirection.TwoWay)] |
public string AppointmentColor |
{ |
get |
{ |
// No color selected |
if (AppointmentColorPicker.SelectedColor.A == 0) |
return null; |
return AppointmentColorPicker.SelectedColor.ToArgb().ToString(); |
} |
set |
{ |
if (string.IsNullOrEmpty(value)) |
return; |
int argbValue; |
if (int.TryParse(value, out argbValue)) |
AppointmentColorPicker.SelectedColor = Color.FromArgb(argbValue); |
} |
} |
<!-- COMPONENT DEFINITION IN .ascx --> |
<telerik:RadColorPicker ID="AppointmentColorPicker" runat="server" CssClass="rsAdvResourceValue" |
ShowIcon="true" PaletteModes="HSV"> |
</telerik:RadColorPicker> |
The additional User Controls should do the rest.
I've gotten most of this to work in my project. But I am also using custom styles from the App_Themes folder which I think is causing a problem with the javascript. So, I can't say for sure I haven't missed something until I get what I've done working correctly.
Also, last year when I tried using the component I found it very difficult to work with so I had created my own user control that did all this and it worked with the Window component. It was just like working with any other user control. However, doing this did require kinda hacking the way you called it from the scheduler and setting properties to essentially have the scheduler only display the data and that's it. I also have way more control of the css files that are being loaded if done this way. After the latest upgrade I thought I'd give it another shot to do it the way Telerik has done it. But, with all the styling and javascript mess I've encountered it looks like I may go back to my original solution.
Hope this helps.
0
G-Man
Top achievements
Rank 1
answered on 26 Jun 2010, 12:00 PM
Hello,
Thank you so much for your response. It was very helpful.
I have decided to create my own Advanced Form so I can have more control over it as you said. I've created it but can't get it to display when i try to create an appointment in the Scheduler. Is there any special code I need to use to get the Advanced Form popping up?
Thank you so much for your response. It was very helpful.
I have decided to create my own Advanced Form so I can have more control over it as you said. I've created it but can't get it to display when i try to create an appointment in the Scheduler. Is there any special code I need to use to get the Advanced Form popping up?
0
Hi G-Man,
Do you get any specific errors? If yes, please specify them.
I recommend you download a working project from here and use it as reference.
Greetings,
Peter
the Telerik team
Do you get any specific errors? If yes, please specify them.
I recommend you download a working project from here and use it as reference.
Greetings,
Peter
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