Solved

Html.DisplayFor -- Hide per User Request, ASP.net MVC4

Posted on 2013-12-13
1
689 Views
Last Modified: 2014-08-04
Does anyone have some ASP.net MVC4 "commandButton"
code that does something like the below step #2 ?

 1. page displays with all values below
 2. user decides they don't want to see the below
      "@Html.DisplayFor(modelItem => item.DR)"
     so they click a "HIDE/SHOW" button
 3. this field disappears, but all others remain visible
------------------------------------------------------------------------------------------------------------
@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.IFSWO)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.DR)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.RefDRNo)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.ProjectID)
0
Comment
Question by:finance_teacher
1 Comment
 
LVL 5

Accepted Solution

by:
Jeroen Timmermans earned 500 total points
ID: 40198778
I'll assume item.DR is a boolean, you can add
@{if(item.DR)}
@{end if}

Open in new window


Around the bits you want to hide.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

746 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now