Note that there are some explanatory texts on larger screens.

plurals
  1. POASP MVC 3 - How to intercept all actions rendering to add conditionally html "class"?
    primarykey
    data
    text
    <p>I would like to know how is the best way to intercept all action being rendered to insert a conditional html class. </p> <p>I have a lot of situation when it will be useful, but think about an access control system where some actions cannot be accessed by current user, and would be nice to change or add a class to all urls rendered that matches this denied actions, disabling them or using any kind of visual effects to tell to the user that these links cannot be accessed (of course that, we are only talking about the visual indicators, because these actions will return permission denied if really accessed).</p> <p>I think that one way would make a html helper that should be used by all programmers, so this helper would render the "class id" conditionally matching each action rendered to the actions permitted to the current user. But on this approach we need to entrust on all programmers to use this html helper instead of the others helpers. </p> <p>Well, does somebody have any others suggestions to do that ? Would be nice if we could do that without depending of all programmers practices to use a specific html helper when coding Views.</p> <p>Regards.</p> <hr> <p>Although is possible to intercept the html rendering in a most low level of ASP MVC, even ASP.NET roots, I also think that the most adequate place to do that would be with a customized html helper. Unfortunately we depend from all others programs to never use the others helpers in this project.</p> <p>Render with a customized html helper is a lot more easy than intercept the rendering, parse it and edit it.</p> <p>Well, if someone has anyone suggestion, please tell us.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload