Solved

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

Posted on 2014-10-16
2
153 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
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

762 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

18 Experts available now in Live!

Get 1:1 Help Now