Mvc UrlHelper in conjunction with JQuery Templates

679 Views Asked by At

I would like to use the Mvc UrlHelper in conjunction with JQuery Templates.

Example template...

...
{{each Items}}        
    <div>
        <%= Url.Action("Action", "Controller", new { Id = "${$value.Id}" })%>
    </div> 
{{/each}}
...

The Url helper Action method encodes the template placeholder that I pass in as the Id parameter. This renders as..

...
<div>
    /web/controller/%24%7B%24value.Id%7D/action
</div>
<div>
    /web/controller/%24%7B%24value.Id%7D/action
</div>
...

I could really do with a way to prevent the Action method from encoding the Id parameter value, but I suppose it’s only doing its job!

1

There are 1 best solutions below

3
On BEST ANSWER

unfortunately its by design and you'll have to work around it - see Rick Strahl's post on this

http://west-wind.com/weblog/posts/831885.aspx