Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6740897
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:39:41+00:00 2026-05-26T11:39:41+00:00

Ok i have a MVC.net front end using EF and SQL server for the

  • 0

Ok i have a MVC.net front end using EF and SQL server for the database connectivity. I’ve created a large object with around 100 fields and a web ui to select and edit objects. I use EF to save changes back to the database. All good so far.

What i need to do now is implement some logic to stop edits for some objects and allow for others. For example:

object “01”
is ok for everyone to make changes no changes needed the interface already covers this.

object “02”
is “locked” against all changes when any user opens that object in the web app all fields should be disabled and the whole thing is read only.

object “03”
is locked for some users but unlocked for others so depending on the users roles they will either get the R/O all disabled view or the enabled edit anything view.

I could just right into this and start hacking something together but i just wondered if there is any “prefered” way or simpler way to achieve this? tnx.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T11:39:41+00:00Added an answer on May 26, 2026 at 11:39 am

    Well the preferred way to do this is do it in your View. So you’d have something like

    <p>
        @Html.LabelFor(model => model.Option1)
        @Html.TextBoxFor(model => model.Option1)
    </p>
    
    <p>
        Option2: @Option2
    </p>
    
    <p>
        @Html.LabelFor(model => model.Option3)
        @if(@User.IsInRole("something")) {
            @Html.TextBoxFor(model => model.Option3)
        }
        else {
            @Model.Option3
        }
    </p>
    

    Peronally I wouldn’t have the @User.IsInRole(xxx) in the View I would have that precalculated in an IsAdmin boolean parameter that is passed through in the ViewModel but I put it there for conciseness in this example.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have an asp.net-mvc web page and i am using jqgrid on the front
I'm using ASP.NET MVC and have a model which has an image (byte array)
I have a pretty big web application that I created last year using ASP.NET
I have created an asp.net MVC application.I created a asp:menu in the master page
We have a large MVC .NET website for a hospital; it has a Doctor
Does ASP.NET MVC have anything like the RESTful out-of-the-box features like Ruby on Rails
I have an .Net MVC application which runs fine if I use the build
ASP.NET MVC routes have names when mapped: routes.MapRoute( Debug, // Route name -- how
ASP.Net MVC Controllers have several methods of forwarding control to another controller or action.
I have ASP.Net MVC project. Plus wordpress blog under a subfolder /Blog. Now, when

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.