AddHtmlAttributes extensions

Jul 5, 2012 at 10:11 PM

Hello,

There are extensions AddRouteValue and AddRouteValues when you create ActionLink:

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

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.

Coordinator
Jul 6, 2012 at 9: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 6: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: http://stackoverflow.com/questions/5563163/t4mvc-use-extension-methods-in-control-library/5574227#comment14960026_5574227

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.

Coordinator
Jul 7, 2012 at 4:59 PM

I started http://t4mvc.codeplex.com/discussions/362362 to discuss this issue. Let's take this 2nd conversation there. Thanks!