开发者

Show/Hide html items in mvc 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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜