Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Html.BeginForm with multiple htmlAttributes

I am using the Html.BeginForm and passing in a css class as per below:

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

that works fine, but I want to add a returnURL querystring parameter after it but that doesn't seem to work:

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

how can I add multiple htmlAttributes so that I can tell it my css class and a querystring parameter?

like image 632
Dkong Avatar asked Aug 25 '12 00:08

Dkong


1 Answers

Use the following overload of BeginForm.

@using (Html.BeginForm("Logon", "Account", 
        new { returnUrl = Request.QueryString["ReturnUrl"] }, FormMethod.Post, 
        new { @class = "form"}))
like image 171
Eranga Avatar answered Oct 23 '22 04:10

Eranga