tags:

views:

58

answers:

2

I have seen in RC 2 release notes says

"The new UrlParameter type allows default values in routes to be removed after URL routing runs."

But I still get the route values in the path.

Here what i get:

<div id="PartialView">
    <%Html.RenderAction("Partial"); %>
</div>
<% using (Ajax.BeginForm("Partial", new { name = "test" }, new AjaxOptions() { UpdateTargetId = "PartialView" }))
   { %>
<button type="submit">
    Submit</button>
<%} %>

In Partial Page:

<% using (Ajax.BeginForm("Partial", new AjaxOptions() { UpdateTargetId = "PartialView" }))
   { %>
<%=Html.TextBox("test") %>
<%} %>

Output of the Partial View Ajax URL is:

/Home/Partial?name=test

Where the Route Values also included in the Ajax Path.

Is this default behavior or defect...?

Thanks, Santhosh

A: 

From Mr. Haacks blog, you need to modify the routes!

routes.MapRoute(
    "Default",
    "{controller}/{action}/{id}",
    new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
Filip Ekberg
by default itself the route contains id = UrlParameter.Optional only. But still and then I get the output with the route value.
santose
Read his latest blog post regarding the matter.
Filip Ekberg
+1  A: 

By default it will append the RouteValues to the URL.

To avoid the RouteValue use Url.GenerateURL("action",....)

Where the RouteValue parameter should new new RouteDictionary()..

And this tooo not working as the RouteValue parameter will just merge with the existing routeData.

santose