gpt4 book ai didi

asp.net-mvc-3 - 具有多个 htmlAttributes 的 Html.BeginForm

转载 作者:行者123 更新时间:2023-12-02 00:52:05 39 4
gpt4 key购买 nike

我正在使用 Html.BeginForm 并传入一个 css 类,如下所示:

@using (Html.BeginForm("Logon", "Account", FormMethod.Post, new { @class = "form" } ))

工作正常,但我想在其后面添加一个 returnURL 查询字符串参数,但这似乎不起作用:

@using (Html.BeginForm("Logon", "Account", FormMethod.Post, new { @class = "form", returnUrl = Request.QueryString["ReturnUrl"] }))

如何添加多个 htmlAttributes 以便我可以告诉它我的 css 类和查询字符串参数?

最佳答案

使用following overload BeginForm

@using (Html.BeginForm("Logon", "Account", 
new { returnUrl = Request.QueryString["ReturnUrl"] }, FormMethod.Post,
new { @class = "form"}))

关于asp.net-mvc-3 - 具有多个 htmlAttributes 的 Html.BeginForm,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12118322/

39 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com