7

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?

1 Answer 1

5

Use the following overload of BeginForm.

@using (Html.BeginForm("Logon", "Account", 
        new { returnUrl = Request.QueryString["ReturnUrl"] }, FormMethod.Post, 
        new { @class = "form"}))
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.