This project is read-only.

AddHtmlAttributes extensions

Jul 5, 2012 at 11:11 PM


There are extensions AddRouteValue and AddRouteValues when you create ActionLink:


It would be nice to also have extensions allowing easily add HtmlAttributes to ActionLink:

@Html.ActionLink("text", MVC.Dinner.Index().AddRouteValue("id","5").AddHtmlAttribute("class","link"))

Let me know if you think that would be a valuable addition.

Jul 6, 2012 at 10:38 AM

ActionLink already has T4MVC overloads that take an htmlAttributes attribute, which works the same way as when not using T4MVC. I think this should cover your needs.

Jul 6, 2012 at 7:26 PM

You right, I've rushed into suggestions without looking through the code really carefully.


However, now that I did, I stumbled across a different issue. It looks like you are aware of it, but I'm not sure if an elegant solution was found.

The issue is per this post on stackoverflow:

My approach to solving the issue would be placing T4 Html Extensions (along with the code that is required to run these) in a separate file. This will allow to deploy only that file in the common project with all custom extensions. The rest of the code would be deployed in project that references that common project, which will exclude any ambiguity problems.

Please let me know if you need more details on the issue from me.

Jul 7, 2012 at 5:59 PM

I started to discuss this issue. Let's take this 2nd conversation there. Thanks!