asp.net mvc - path to controller action -


it no problem use html.actionlink in view obtain right path controller action. wondering whether possible in other layers (e.g. controller). asking because generating <ul> recursively data access render 'link tree structure'. thanks!

christian

in controller can use urlhelper create url.

string html = string.empty; urlhelper url = new urlhelper(httpcontext.request.requestcontext); string edit = url.action(constants.action_edit, constants.ctrl_mycontroller, new { someid }); html += "<a href=\"" + edit + "\">edit</a> "; 

this create string html link inside. in example use constants give correct action , controller, of course "normal" string.

let me know if need more scenarios


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -