I have ran into an odd problem with the ActionLink method in ASP.NET MVC Beta. When using the Lambda overload from the MVC futures I cannot seem to specify a parameter pulled from ViewData.
When I try this:
<%= Html.ActionLink<PhotoController>(p => p.Upload(((string)ViewData["groupName"])), "upload new photo") %>
The HTML contains a link with an empty URL.
<a href="">upload new photo</a>
However if I hard code the parameter, like this:
<%= Html.ActionLink<PhotoController>(p => p.Upload("groupA"), "upload new photo") %>
The output contains an actual URL.
<a href="/group/groupA/Photo/Upload">upload new photo</a>
I assume this probably has something to do with the visibility and availability of the ViewData, and it not being there when the Lambda gets evaluated by the internals of the framework. But that is just a guess.
Am I doing something incorrect in the first sample to cause this, or is this some short of bug?
Update: I am using the latest version of the MVC futures. It has been pointed out that this works for some people. Since it doesn't work for me this makes me think that it is something specific to what I am doing. Does anybody have any suggestion for what to look at next, because this one really has me stumped.