2012-08-25 62 views
6

我使用Html.BeginForm和CSS類通過按如下:Html.BeginForm多htmlAttributes

@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類和查詢參數?

回答

4

使用following overloadBeginForm

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