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 7444759
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:34:55+00:00 2026-05-29T11:34:55+00:00

Using an asp.net mvc webgrid, is it possible to render a column using Html.DisplayFor

  • 0

Using an asp.net mvc webgrid, is it possible to render a column using Html.DisplayFor for the current row/column?

    grid.Column("Roller", "Roller", canSort: true, format: @<text>@Html.DisplayFor( <the row result here> )</text>)

The Html.DisplayFor(m) helper uses the page model, not the current row item. Is there a way around this.

Thanks

// Johan

  • 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-29T11:34:56+00:00Added an answer on May 29, 2026 at 11:34 am

    Yes, it is possible. For an example, consider you are binding a list of Banner objects to your WebGrid. Also consider the Banner.Active property, which is a boolean value that you want to be rendered as a CheckBox. You can do this:

    format: (item) => { var banner = item.Value as Banner;
                        return Html.DisplayFor(modelItem => banner.Active); 
                       }
    

    You could also do this:

    format: (item) => Html.DisplayFor(modelItem => ((item as WebGridRow).Value as Banner).Active)
    

    But I would consider the first option more readable.

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

Sidebar

Related Questions

Using asp.net MVC I'd like to do this inside a view: <%= Html.TextBox(textbox1, null,
If you are using ASP.NET MVC how are you doing grid display? Rolled your
Using ASP.NET MVC 2 and and Html.RenderAction in my masterpage implemented as below throws
From Entity Framework using ASP .NET MVC 3.0, is it possible to use a
I've been developing an asp.net mvc 3 application and I'm using webgrid to show
Possible Duplicate: ASP.NET MVC - View with multiple models Using ASP.NET MVC 3.0, how
Using ASP.NET MVC there are situations (such as form submission) that may require a
Using ASP.Net MVC on my Site.Master I have: <head runat=server> <title><asp:ContentPlaceHolder ID=TitleContent runat=server />
Using ASP.NET MVC when trying to get the information stored on my Session[objectName] from
Using ASP.NET MVC 2.0, I have an actionlink that is used for comments on

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.