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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:23:13+00:00 2026-06-13T10:23:13+00:00

I am using the MVC Contrib Grid for rendering, sorting and filtering my data

  • 0

I am using the MVC Contrib Grid for rendering, sorting and filtering my data grid, but I am having problems now that it has been upgraded for MVC3 and Razor. The Custom method in my columns collection does not work for aspx pages , and the columns Action method is now obsolete.

I use grids action method to render my columns like this in MVC 2:

 ...
 <% Html.Grid(Model).Columns(column => {
            column.For(x => x.Id);
            column.For(x => x.Name);
            column.For(x => x.Email);
            column.For(x => x.DateOfBirth);
            column.For("View User").Named("Tools").Action(x => { %>
                 <td>
                   <%= Html.ActionLink("View", "View", new { id = p.Id })%>
                   <%= Html.ActionLink("Edit ", "Edit", new { id = p.Id })%>
                   //Snip as there are too many tools :-)
                   //.....
                   <%= Html.ActionLink("Delete", "Delete", new { id = p.Id })%>
                </td>
            <% });
 ...

Now with the latest version there is a Custom method that replaces the obsolete Action method. I looked at how it can be done in here, which basically works for me now, but I loose all my helpers in the aspx view (url, etc), and now need to render my contents in another method in my model like below:

 ...
 <% Html.Grid(Model).Columns(column => {
            column.For(x => x.Id);
            column.For(x => x.Name);
            column.For(x => x.Email);
            column.For(x => x.DateOfBirth);
            //the new custom column 
            column.Custom(Model.ToolsRenderer);
            <% });
 ...

The grid model method below called ToolsRenderer is used to render my html string.

 public UserManagementViewModel : BaseModel {
   //..snip
   //
     public object ToolsRenderer(Client client)
     {
        List<string> links = new List<string>();

        var editLink = new TagBuilder("a");
        // here is my biggest problem, before  Html.ActionLink used to make
        // sure that I don't have any missing links or help me if i need to 
        // refactor an action / controller name :-(
        editLink.Attributes["href"] = GetEditUserLink(client,   HttpContext.Current.Request.Url.AbsoluteUri);
        editLink.SetInnerText("edit");
        links.Add(editLink.ToString());
        ...
        ...lots of links to be generated here
        ...
        return MvcHtmlString.Create(string.join(" |", links))
        }
   //..snip
}

This works for now, but is there a way to get my aspx page working like the razor views like below?

@Html.Grid(Model).Columns(column =>
{
  column.For(x => x.Id).
  column.For(x => x.Name);
  column.Custom(@<td><a href='@Html.Actionlink("edit","user",new {id})' alt="@item.email"/><a></td>)

})

I want to say something like:

...     
column.Custom(%><td><a href='<%=Html.Actionlink("edit","user",new {id})%>' alt="<%=item.email%>"/><a></td><%)
...
  • 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-13T10:23:14+00:00Added an answer on June 13, 2026 at 10:23 am

    Finally managed to find a work around with some help and digging, and instead of using the custom column, use column.for and push in the Html.Partial. Something like the code below.

    <% Html.Grid(Model).Columns(column => {
            column.For(x => x.Id);
            column.For(x => x.Name);
            column.For(x => x.Email);
            column.For(x => x.DateOfBirth);
    
            // could use RenderPartial() to
            column.For(x =>Html.Partial("UserActionColumn", x));
    
            <% });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i m using Mvc Contrib grid to represent the data, now i want to
I have been following this nice walkthrough for creating a grid using MVC contrib.
I'm using the Contrib Grid for ASP.NET MVC and I was wondering if there
I m using MVC Contrib grid in the application , i want to change
i want to do sorting in the mvc contrib grid....so far i have i
I am using the mvc contrib grid and generate the pager like this: <%=
In my attempt to enable sorting and filtering in conjunction with the MVC contrib.
I have MVC3 controllers in external assemblies using MVC contrib's portable areas but I'm
I just started using the MVCContrib grid in a test project. I'm having a
I am developing a commercial MVC2 app that requires a grid that has callback

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.