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

Abort view change

5 Answers 59 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Håkan
Top achievements
Rank 1
Håkan asked on 16 Feb 2012, 12:39 PM
Hi.

I have a ScheduleView with four different ViewDefinitions, all of them loading their own different data.
In one of the views, the user is able to add/modify multiple appointments before pressing a save button that will save all modifications in a batch.

Now I want the user to get a warning when he tries to switch to another view without saving first.
I have an IsModified flag on the appointment, so it is easy for me to check if any appointments are modified and display a warning message with OK/Cancel buttons.

But how can I prevent the view switch if the user wants to abort?

Today I have bound ActiveViewDefinition in my view model that will throw an event back to my ScheduleView whenever the view is changed. The problem is that this event will be triggered too late, when the view has already changed.

So, can I trigger it sooner and can I cancel the view switch somehow?

Regards,
Håkan

5 Answers, 1 is accepted

Sort by
0
George
Telerik team
answered on 21 Feb 2012, 04:51 PM
Hello Håkan,

 
Currently RadScheduleView doesn't support canceling view change because there aren't any events for it. What I could suggest is to return to the previous view (after changing) instead of aborting it.

Hope this helps.


Greetings,
George
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Håkan
Top achievements
Rank 1
answered on 22 Feb 2012, 07:50 AM
Hi George!

Well, that doesn't work for me unfortunately.
As soon as I switch view I load other data (each view has it's own data).
So by the time I switch back, my previous data is already gone.

Is there anyway to disable the view definition buttons (the ViewModeSelection ListBox)?
That would be one way for me to prevent the user from switching view.

The cancelling events would be a nice feature to add in future release though...

Regards,
Håkan
0
George
Telerik team
answered on 27 Feb 2012, 09:13 AM
Hi,

 
Yes, you can disable the view definition button. What I would suggest is editing the control template and manual set IsEnable="False" to these buttons.

Thank you for your suggestion, we will consider it in our further releases.


All the best,
George
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Håkan
Top achievements
Rank 1
answered on 27 Feb 2012, 09:27 AM
Hi George!

Well, but I need to disable the buttons for a specific case, so I can not hard code it in the template.
Can I bind the IsEnable property to something that can be changed during runtime?

Regards,
Håkan
0
Rosi
Telerik team
answered on 02 Mar 2012, 11:05 AM
Hi,

You can bind the IsEnabled property.

Another thing you can do is to implement a command binding to the commands associated with the buttons and override their CanExecute  methods.

DayView button is associated with command

SetDayViewMode Command

WeekView button is associated with command

SetWeekViewMode Command


MontView button is associated with command

SetMontViewMode Command

More about commands you can read here.
More about command binding you can read here
Regards,
Rosi
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
ScheduleView
Asked by
Håkan
Top achievements
Rank 1
Answers by
George
Telerik team
Håkan
Top achievements
Rank 1
Rosi
Telerik team
Share this question
or