开发者

MVC 3 form action parameter

开发者 https://www.devze.com 2023-02-09 09:21 出处:网络
I\'m new to MVC and just started using 3.0.When I load a a partial view, that contains a form, using jquery I\'ve noticed that a parameter gets added to the action:

I'm new to MVC and just started using 3.0. When I load a a partial view, that contains a form, using jquery I've noticed that a parameter gets added to the action:

/hi/address/edit/1?_=1297158351246&{}

The ascx file contains the following:

<% using (Html.BeginForm()) { %>
<% } %>

I realise I can call the following 开发者_StackOverflowcode to remove the parameter, but I would like to know why the extra parameter and what's it's purpose?

<% using (Html.BeginForm("edit", "address")) { %>
<% } %>

UPDATE:

When the form isn't loaded using jquery, no additional parameters are present in the forms action.


Could you check what you are passing in on your edit link? I think you might have an encoding issue somewhere?

When you clicked on a link to edit your item it looks like it has pulled in an undefined parameter called _?

This info is used to choose the correct controller and action and also set the parameters in the controller's action on the submission return.

I'm not 100% sure, but I think hardcoding the BeginForm variables you might loose the id in the submit, unless you have it as a hidden variable?

P.S. If you are using mvc 3 look at using razor, its loads of fun...

instead of breaking in and out using <% %> you now use @

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号