c# - ASP.NET MVC: Get controller's route value to build action links in model -


i'm using telerik kendo ui , apparently grid view not allow me build using foreach loop , customize table provides auto-binding. in case not possible me add action links table particular route values.

in order solve problem, easiest way came mind (a non-js approach don't enjoy java script) create 2 notmapped read properties in entity model extending auto generated class entity framework to:

[metadatatype(typeod(xmodel))] public partial class entityx {     [notmapped]     public string edit => "<a href='controllername/actionname?id="+ id.to.string()+"'>edit</a>"; ... } 

although approach working, it has big problem , if change route config, have update links!!

my question that, how can generate such urls or action links similar way @html.actionlink helper in area outside of both view , controller (i mean can't reuse linkextensions) in order solve routing problem?


Comments