Monday, October 17, 2016

how to make a field in a DevExpress MVC grid a link

settings.Columns.Add(m => m.Name, column =>
{
   column.SetDataItemTemplateContent(content =>
   {
      ViewContext.Writer.Write(
         Html.ActionLink(Context.Text, "Action", "Controller", new { foo =
                DataBinder.Eval(content.DataItem, "Name")}, null).ToHtmlString()
      );
   });
});

 
 

Yes, you have to have that null. Trust me.

No comments:

Post a Comment