I have an asp.net MVC web app using Kendo UI Grids with client templates. The client template specifies an href as follows:
.ClientTemplate("<a href='[controller]/[action]/[parameters]' />")
In a debug run, the link is correctly generated as follows:
http://localhost:[port]/[Controller]/[Action]?[parameters]
works beautifully.
However, in a deployed environment, the link generated is as follows:
http://[server]/[Controller]/[Action]?[parameters]
And that fails because it is missing the website name. So what I need is for it to generate the links as follows:
http://[server]/[WebSite]/[Controller]/[Action]?[parameters]
How do I need to specify my href links for this to work?
Don’t hand-code your url’s instead of use the UrlHelper which will take care of including the virtual directory into your urls:
If you want to use the client template value in the url you have to build the url dynamically because the Kendo UI template syntax won’t inside the route value: