Hi folks,
I've got a simple html form with a few input boxes. When i click save, it finds the correct method but the data is weird. When i have a form field name that is the same name as a field in the route, the value passed in is my form field data, not the route data.
for example.
Imagine u have the following route.
// Both Get/Post
routes.MapRoute(
"User-Edit",
"user/{displayName}/edit",
new { controller = "Account", action = "edit" });
and the following method...
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Edit([Bind(Exclude = "UserId")]string displayName,
FormCollection formValues)
{ ... }
Now, notice how the route has the variable displayName
and the controller action also has a argument called displayName
? Well, the argument data is that from the form, NOT the route.
I'm not sure how i can make sure the argument data is the route data?
Is the only fix here for me to rename the route variable, from displayName
to routeDisplayName
or whatever.. ?