Strange Html.ActionLink () behavior after upgrading to beta 1

I updated a large ASP.NET MVC application that I was working on to the latest beta today, and after some initial problems, it basically works again for me. The big problem is that I have things like this:

<%= Html.ActionLink("LOGIN", "Index", "Authorization", new { redirect=Request.Url })%>

      

and

<%= Html.ActionLink("Edit this page", "Edit", "Webpages", new { id = wp.Id })%>

      

This will display links as:

http://localhost:60321/calendar/edit?Length=8

      

Although at different "lengths". I have no idea why this is happening; as if my route tables went completely insane. "calendar / edit / {id}" is a valid route, but about the fourth on the list. They have worked great before.

I kind of figure it out, trying to figure out what's going on ... The link text looks great; it is just the url of some ActionLink calls that I am not working. Some of them work fine. Here's an example of one that works great:

<%= Html.ActionLink("ADMIN", "Index", "ControlPanel") %>

      

Any help would be greatly appreciated!

0


source to share


1 answer


From looking at the method signatures in ActionLink it looks like they have changed and it matches the following:

ActionLink( string linkText, string action,
            object values, object htmlAttributes );

      

I would try adding null htmlAttributes to the end of the ones that don't work so that it uses this one:

ActionLink( string linkText, string action, string controller,
            object values, object htmlAttributes );

      



It will look like this:

<%= Html.ActionLink("LOGIN",
                    "Index",
                    "Authorization",
                    new { redirect=Request.Url },
                    null )%>

      

The source code for MVC Beta 1 is located at http://www.codeplex.com/aspnet (SCC server 12/18/2008 1: 16Pm CST is not available at this time). I found signatures via intellisense.

+2


source







All Articles