调用Html.BeginForm并指定操作 [英] Calling Html.BeginForm and specifying action
本文介绍了调用Html.BeginForm并指定操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我一直在尝试执行以下操作,但是无论如何,我都会不断遇到不同的错误:
I have been trying to do the following but whatever I try I just keep getting different errors:
@using (Html.BeginForm(Url.Action(this.ViewContext.RouteData.Values["action"] as string)))
例如,这产生了:
<form action="/adminTests/create?Length=22" method="post">
有人知道怎么做吗?
推荐答案
您正在使用
或: ,或者如果您想生成到当前网址的POST表单,请简单地使用(请注意,这将包括任何查询字符串参数): or if you want to generate a form POSTing to the current url use simply (note that this will include any query string parameters): 有关可用重载的完整列表,请参考文档. For full list of available overloads consult the documentation. 这篇关于调用Html.BeginForm并指定操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!@using (Html.BeginForm(ViewContext.RouteData.Values.GetRequiredString("action"), ViewContext.RouteData.Values.GetRequiredString("controller"))))
@using (Html.BeginForm())
查看全文