开发者

MVC 3 form action parameter

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜