Current filter:
                                You should refresh the page.
                                0
                                  • Hello.


                                    Is there any easy way to force the SelectedResource property of SchedulerListEditorBase via code ?


                                    Because it's readonly... and I don't find another way.


                                    Thank you



                                • Carlo Alberto Borri 06.15.2012

                                  anybody ?

                                • Would you please clarify exactly what you wish to change in the scheduler? As stated in our documentation, the SelectedResource property "gets the resource which contains the time interval currently selected in the scheduler's active view by an end-user". So, changing this property manually does not seem to make sense.

                                • Carlo Alberto Borri 06.19.2012

                                  Hi Anatol.
                                  What I waht is :
                                  In the Scheduler (ASP) I want to be able to force the selection of a certain resource. In my project I associated a resource wich each user. And when the user enters his own agenda (scheduler) the application should set his resource, not the first in the alphabetical order.
                                  As you can see in the attachment the first selected resource is Alessandra. Instead, I want to select the resource associated with the current user (Rino Affidato).

                                  I hope I made myself clear.

                                  thank you for your time

                                You must  log in  or  register  to leave comments

                                1 Solution

                                0

                                Hello Carlo,

                                To specify a resource selected in the resource navigator, set the FirstVisibleResourceIndex and ResourcesPerPage properties of the scheduler view, as shown below:

                                	
                                [C#]
                                public partial class ViewController1 : ViewController<ListView> { public ViewController1() { TargetObjectType = typeof(IEvent); } protected override void OnViewControlsCreated() { base.OnViewControlsCreated(); ASPxSchedulerListEditor schedulerListEditor = View.Editor as ASPxSchedulerListEditor; if (schedulerListEditor != null) { schedulerListEditor.ResourceDataSourceCreated += new EventHandler<DevExpress.ExpressApp.Scheduler.ResourceDataSourceCreatedEventArgs>(schedulerListEditor_ResourceDataSourceCreated); } } void schedulerListEditor_ResourceDataSourceCreated(object sender, DevExpress.ExpressApp.Scheduler.ResourceDataSourceCreatedEventArgs e) { SchedulerViewBase currentSchedulerView = ((ASPxSchedulerListEditor)sender).SchedulerControl.ActiveView; IList resources = (IList)((WebDataSource)e.DataSource).Collection; foreach (DevExpress.Persistent.BaseImpl.Resource resource in resources) { if (resource.Caption == SecuritySystem.CurrentUserName) { currentSchedulerView.FirstVisibleResourceIndex = resources.IndexOf(resource); currentSchedulerView.ResourcesPerPage = 1; break; } } } }
                                You can also hide all resources except the resource associated with the current user by filtering the resources datasource in the ResourceDataSourceCreated event handler, as shown in the How to create fully custom Role, User, Event, Resource classes for use with the Security and Scheduler modules example.

                                Show all comments
                                • Carlo Alberto Borri 06.21.2012

                                  Thank you Anatol.
                                  It seems to work, but there is a problem :
                                  The ReportdataSourceCreated event is fired even then I manually select another resource.
                                  So, in the RDSC event i set the resource associated with the current user, but the user manually selected another. It's not right.

                                  Can I set the resource in another event ?

                                • The ReportdataSourceCreated event is raised because the resource selection initiates a callback, and the scheduler control is recreated in this callback. However, this should not cause any problem, because this affects only the initial value, and if the value is changed by a user, it is restored after callback. Please see the attached video.

                                • Carlo Alberto Borri 06.22.2012

                                  It affects and it's the following problem :
                                  - I enter the scheduler and autmatically selects the resource associated with my user. It works fine.
                                  - I select another resource
                                  - the ResourceDataSourceCreated event is fired and reselects the resource associated with my user
                                  - in the appointment list I see the correct events (associated with the user selected resource)
                                  - BUT I CANNOT CHANGE anything. I can only see te event, but it's readonly. The Modify option in the right click menu is disabled. I can however add new events.
                                  - So, the main problem is the readonly events (appointments) associated with the selected resource other than the one associated with my user.

                                  I hope I made my self clear.

                                  Thank you for your time again

                                • Carlo Alberto Borri 06.25.2012

                                  the issue is not solved. can you please check the last comment please ?

                                  thank you

                                • I have reproduced the problem in version 11.1. However, it does not occur in version 11.2. The problem will unlikely be fixed in version 11.1, so I suggest that you update our components to a newer version. If this is impossible, please use solution from the How to use SingleChoiceAction to show a certain resource in Scheduler example as a workaround.

                                • Carlo Alberto Borri 06.26.2012

                                  OK. I'l try an upgrade as soon as possible.

                                  Thank you for you time again

                                • You are welcome!

                                You must  log in  or  register  to leave comments
                                You must  log in  or  register  to leave an answer

                                Is your intention to post an answer to your own question?

                                • If so, then proceed.
                                • If you simply wanted to post additional information, ask for further clarification, or to just say "Thanks!", please click Leave a Comment.
                                • If you wish to edit your original question, please use the Edit button in the Toolbox at the top right corner of that entry.