Solved

Field security -- ASP.Net MVC 4 C#

Posted on 2013-06-20
3
532 Views
Last Modified: 2013-07-03
I am using ASP.Net MVC 4 C# Simple Membership.

What easy add-on/etc can I get make the
below View/Index.cshtml coding easier ?

Summary
 1. Index.cshtml page has 100+ textboxes
 2. each textbox has one of the below options
    depending on record's WorkFlowStage
    and logged in user's role
       ** Hidden
       ** ReadOnly --> below DisplayFor
       ** ReadWrite --> below EditorFor
------------------------------------------------
            @if(item.WorkFlowStage == '2')
            {
                if (User.IsInRole("BUICK_Inspector"))
                {    
                    <td>@Html.EditorFor(modelItem => item.CreatedBy)</td>
                    //also put 100+ other textboxes that are on this form
                }

                if (User.IsInRole("BUICK_LeadMan"))
                {    
                    <td>@Html.DisplayFor(modelItem => item.ProjectID)</td>
                    <td>@Html.DisplayFor(modelItem => item.CreatedBy)</td>
                    //also put 100+ other textboxes that are on this form
                }
               
                else
                {
                    <td>@Html.DisplayFor(modelItem => item.ProjectID)</td>
                    <td>@Html.DisplayFor(modelItem => item.CreatedBy)</td>
                    //also put 100+ other textboxes that are on this form
                }
            }

            @if(item.WorkFlowStage == '3')
            {
                if (User.IsInRole("BUICK_Tech"))
                {    
                    <td>@Html.EditorFor(modelItem => item.CreatedBy)</td>
                    //also put 100+ other textboxes that are on this form
                }

                if (User.IsInRole("BUICK_LeadMan"))
                {    
                    <td>@Html.DisplayFor(modelItem => item.CreatedBy)</td>
                    //also put 100+ other textboxes that are on this form
                }
               
                else
                {
                    <td>@Html.DisplayFor(modelItem => item.ProjectID)</td>
                    <td>@Html.DisplayFor(modelItem => item.CreatedBy)</td>
                    //also put 100+ other textboxes that are on this form
                }
            }
0
Comment
Question by:finance_teacher
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 23

Expert Comment

by:Roopesh Reddy
ID: 39267440
Hi,

You can try Fluent Security - http://www.fluentsecurity.net/

Hope it helps u...
0
 

Author Comment

by:finance_teacher
ID: 39292872
I emailed fluentsecurity.net and they said their premade solution does not do this.

Any other ideas ?
0
 
LVL 23

Accepted Solution

by:
Roopesh Reddy earned 500 total points
ID: 39294285
0

Featured Post

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
.NET Enums [Flags] & Bitwise Design Question 6 39
Aspx calendar pop up control 3 28
Need help with a query 14 37
c#, case, if 4 19
Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question