I use MVC3 Razor and have a link
<a href="@Url.Action("Edit", "Obj", new { id = RSAuth.UserId })" class="gray-butt right">Edit</a>
I have written HtmlHelper
public static MvcHtmlString MyHelper(this HtmlHelper helper, string name, string href, string @class = null)
{
var builder = new TagBuilder("a");
builder.MergeAttribute("href", href);
builder.AddCssClass(@class);
builder.InnerHtml = name;
return new MvcHtmlString(builder.ToString());
}
and this link is bad
@Html.MyHelper("Edit","@Url.Action('Edit', 'Obj', new { id = RSAuth.UserId })", "gray-butt right")
Can you try this?
@Html.MyHelper("Edit",Url.Action('Edit', 'Obj', new { id = RSAuth.UserId }), "gray-butt right")
remove the quote for Url.Action, because it is a function that return a string