开发者

Show/Hide html items in mvc application

开发者 https://www.devze.com 2023-01-24 14:41 出处:网络
i am using membership provider to get roles for开发者_运维技巧 the user that logged in to my application.

i am using membership provider to get roles for开发者_运维技巧 the user that logged in to my application. But, i wonder how i am hiding/showing html items on the screen based on that roles?

** I am using viewModel for each of my views in the application.

Thanks..


If your app is in ASP.NET MVC, Use this:

          <% if(Roles.IsUserInRole("myRole")) { %>
             <!-- show my html -->
            <% } else { %>
            <!-- show something else -->
          <% } %>  
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号