According to this question, I am supposed to be able to write something like this:
@Html.ActionLink( "Delete", "Delete", "Message", new { data_id=id, @class="delete" } )
or as a happy T4MVC user can do:
@Html.ActionLink( "Delete", MVC.Message.Actions.Delete(), new { data_id=id, @class="delete" } )
And get the underscore in "data_id" replaced during rendering:
<a href="/message/delete" class="delete" data-id="42">Delete</a>
However, this seems not to work in the MVC 4 beta. Anyone else seeing this problem?
Is it an intentional change, and if so, what should I do instead?
UPDATE - HOW TO FIX (MANUALLY)
I've applied the following changes to the T4MVC.tt file, which fixes the problem in the generated code:
public static MvcHtmlString ActionLink(this HtmlHelper htmlHelper, string linkText, ActionResult result, object htmlAttributes, string protocol = null, string hostName = null, string fragment = null) {
//was: return ActionLink(htmlHelper, linkText, result, new RouteValueDictionary(htmlAttributes), protocol, hostName, fragment);
return htmlHelper.RouteLink(linkText, null, protocol, hostName, fragment, result.GetRouteValueDictionary(), HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes));
}
UPDATE 2 - FIX AVAILABLE
David Ebbo was lightning fast at responding to the reported issue and has already merged the above fix into T4MVC.
UPDATE 3 - FIX THE FIX
Quite embarassingly, the original fix submitted did in fact not work, as it still called an invalid overload. I've now modified the code to do the same as MVC does internally (using their helper method), and notified David to have it included in T4MVC. Grab 2.6.70 from codeplex or update using NuGet when its released, probably shortly.