Quantcast
Channel: DevExpress Support Center (Examples)
Viewing all articles
Browse latest Browse all 7205

How to show a specific View for some users

$
0
0

Scenario:

This example demonstrates how to show a custom View against a role of the currently logged user. Custom Views were created and customized through the Model Editor for each role separately. For more convenience, custom Views have a name of a role in the Id attribute. For instance: Contact_ListView_Administrators, Contact_DetailView_Administrators, Contact_ListView_Users, Contact_DetailView_Users, etc. You may consider a specific naming convention, for example, to add a role name to the end of the view name.


Implementation details:

1) There is CustomizeViewAgainstRoleMainWindowController that tracks View showing using the XafApplication.ViewCreating event and replaces the default View's Id with a custom Id found in the Application model by the role name. 

1 alt)Alternatively, you can handle the XafApplication.UserDifferencesLoaded event and patch the ViewID of required navigation items under the NavigationItems node as well as the DefaultListView/DefaultDetailView attributes of the BOModel | Class nodes.

Question Comments

Added By: Serkan Dede 1 at: 1/14/2016 10:27:35 AM    

Hi,

I got error in Application_ViewShowing method on line :
e.View.SetModel(modelView);

Error Message:
Cannot change property 'DefaultSorting' when the XPCollection is not in design or initialization mode.

Any idea to resolve this issue?

Added By: Dennis (DevExpress Support) at: 1/15/2016 2:02:00 AM    

Hello Serkan,

To process your recent post more efficiently, I created a separate ticket on your behalf: T334575: The "Cannot change property 'DefaultSorting' when the XPCollection is not in design or initialization mode" error occurs when calling e.View.SetModel(modelView);. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Added By: Joel Sanches at: 4/20/2016 11:27:52 AM    This is marked as obsolete. What would be the present recommendation to handle the same scenario in XAF?Added By: Alexey (DevExpress Support) at: 4/21/2016 9:25:16 AM    

Hello Joel ,
I've created a separate ticket on your behalf (T370594: E274 in 15.2). It has been placed in our processing queue and will be answered shortly.


Viewing all articles
Browse latest Browse all 7205

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>