Solved

apply formatting and styles to MVC view (migration from gridview)

Posted on 2014-10-16
2
167 Views
Last Modified: 2014-10-17
hi,
I am teaching myself a bit of MVC web design. I have a asp.net VB site that I want to try and convert some features to MVC.

I have got my data in a vbhtml page showing, but I need to apply some rules

ie,

convert

   @Html.DisplayFor(Function(modelItem) item.FLT_INCIDENT )

to say something like, if item.FLT_INCIDENT value is 2, then display the word Request.

I used to use

  If e.Row.Cells(2).Text = "2" Then
                e.Row.Cells(2).Text = "Request"
                RequestImage.Visible = True
            Else
                e.Row.Cells(2).Text = "Incident"
                IncidentImage.Visible = True

            End If

Open in new window


when it was in a Grid View.

I don't understand if I should use a helper function or not.
0
Comment
Question by:Steven Wells
[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 Comments
 
LVL 23

Accepted Solution

by:
Ioannis Paraskevopoulos earned 500 total points
ID: 40386337
Hi,

You may use If operator, that will
@Html.DisplayFor(Function(modelItem) If(item.FLT_INCIDENT = "2","Request","Incident") )

Open in new window


Giannis
0
 
LVL 12

Author Comment

by:Steven Wells
ID: 40386391
Cool. Thanks
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

734 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