I’m trying to create an html helper to render a button. As an example this needs to contain –
<button onClick="window.location='/Users/Edit/admin'">
I have tried to do this using TagBuilder but am having issues because MergeAttribute is encoding the html.
e.g.
buttonBuilder.MergeAttribute(“onClick”, “window.location='” + url.Action(action, controller, routeValues));
gives me –
<button onClick="window.location='/Users/Edit/admin">
Is there a way I can do this so it’s not encoded? Or should I be using another method other than TagBuilder?
–EDITED
I almost forget, use the HtmlDecode:
Or look it: http://forums.asp.net/t/1377957.aspx/1