user value as hyperlink name in GRID.MVC

Oct 9, 2013 at 8:40 AM
hi
tell me how to use value as link text in grid mvc
here is what i m doing
@Html.Grid(Model).Columns(columns => 
                    {
                        columns.Add(c => c.FirstName).Titled("Username").Filterable(true).Sanitized(false)
                                .Encoded(false).RenderValueAs(o => Html.ActionLink("", "Edit", "Admin", new { Id = 0 }, null).ToHtmlString());
                        columns.Add(c => c.Email).Titled("Email");
                        columns.Add(c => c.IsBlocked).Titled("Blocked");
                        columns.Add(c => c.IsApproved).Titled("Approved");
                        columns.Add(c => c.LastLoginDate).Titled("Last Login");
                        columns.Add(c => c.RegisterationDate).Titled("Registeration Date");
                    }).WithPaging(10).Sortable(true)
want to usse username as link text and its id what should i have to do??
Coordinator
Oct 9, 2013 at 10:31 AM
Hi,
RenderValueAs(o => Html.ActionLink("", "Edit", "Admin", new { Id = 0 }, null).ToHtmlString());
In your case "o" - it is a row in the Model collection, use it to access their properties
RenderValueAs(o => Html.ActionLink(o.FirstName, "Edit", "Admin", new { Id = 0 }, null).ToHtmlString());
Marked as answer by mohsin1122 on 10/9/2013 at 3:42 AM