brain dust

The Absolute.

Tuesday, April 12, 2005

Custom Eventing Finally Used!

One issue that I ran across today was how to control from the super class level what content area to display at the page level. Custom events was the perfect scenario.

Anyone who has worked with asp.net has worked with Events. Its a way to notify an object of a change in another object. For asper's it is a new frame of mind.

So I have a super class that all of the pages in the portal will inherit from. Part of that super classes job is to add a navigation control to allow the user to switch between the different security context in the page. My current security objects are:

View
Edit
Settings
Personalization

Each one of these rolls down to a panel. The panel must be defined on the page. The super class compares the rights a user has to determine if he can see that panel. Only one panel at a time can be visible. So the navigation control has 4 buttons(image buttons) that show as active only if the super class has determined that the user has the correct policy at run time.

The interesting issue this brings up is the fact that the navigation may know what to show, but how does the programmer know when to do stuff to his objects contained in his page within those given security context.

What I ended up with is a set of custom events at the super class level. Part of the security logic decides which event to fire, and the developer can override those events at the page level to add binding of data to his controls at run time.

Works perfectly!

0 Comments:

Post a Comment

<< Home