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

  • SEARCH
  • Home
  • 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 7774085
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:17:23+00:00 2026-06-01T17:17:23+00:00

I have an asp.net mvc3 C# application. It uses a database. The database supports

  • 0

I have an asp.net mvc3 C# application. It uses a database. The database supports a soft-delete scenario due to requirements. The soft-delete scenario does not cascade. Records which have been flagged as deleted will be showed as grayed out. My issue is with how to do this without having to always surround each display from the model with some html markup and style.

For example:

<span @if(m.Box.isDeleted){
 <text>style="background-color:gray"</text>
 }>@m.Box.Name @m.Box.Description</span>

I can do that, but look at all the extra markup I have to do to literally every ViewModel object display.

What I would like to do is @m.Box.Name.AddMarkup() or something to that extent. Perhaps I could make a helper which took the item and then returned the correct markup such as

namespace place.Markup
public class Markup
{
 public ModelItem(object o, property name)
 {
  //perhaps use reflection so the flag isnt passed all the time
  //create markup with flag conditional decoration
  //return markup
 }
}

and then

@Markup.ModelItem(@m.Box.Description)

I am not sure how I should approach this, or if either of the suggested ways is how others approached this issue. What have you tried to display soft-deleted items? Is there a good tutorial for this somewhere? I couldn’t really find much material on this subject.

Please note: the filtering of these objects is not an issue, they are intentionally being displayed and they need to be displayed in a manner which reflects the soft-delete.

  • 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-06-01T17:17:25+00:00Added an answer on June 1, 2026 at 5:17 pm

    I would make an htmlHelper based on one or many overloads of DisplayFor

    Something like

     public static MvcHtmlString DisplayDeleteCheckFor<TModel, TValue>(
        this HtmlHelper<TModel> html,
        Expression<Func<TModel, TValue>> expression, bool condition) {
    
         var value = html.DisplayFor(expression).ToString();
         var style=condition ? "style=\"background-color:gray\"" : string.Empty;
    
         return MvcHtmlString.Create(
             string.Format("<span {0}>{1}</span>", style, value));
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a ASP.NET MVC3 application, which uses JSON to comunicate with a Flash
I have an ASP.NET MVC 3 application that uses the Ninject.MVC3 extension to setup
We have an ASP.NET application on ASP.NET 4.0 using MVC 3 which uses Windows
I have a ASP.NET MVC3 application that handles time-consuming processes (copying a large file
I am creating an ASP.NET MVC3 application using NHIBERNATE. I have a base class
This is about asp.net mvc3 web application. We have used Object cache to store
My application is in Asp.Net MVC3 coded in C#.Net. I have Views which contains
I have an ASP.NET MVC 3 (using Entity Framework 4.2) application that uses transactions
We have a ASP.NET MVC 3 application that uses unobtrusive jQuery validation. The page
I have an ASP.NET MVC3 application in C# and Razor. In the view MyView

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.