2012-08-25 16 views
6

Używam Html.BeginForm i przechodzących w klasie css jak na poniżej:Html.BeginForm z wieloma htmlAttributes

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

że działa dobrze, ale chcę dodać parametr ReturnURL ciągu kwerendy po to jednak, że nie wydaje się działać:

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

jak mogę dodać wiele htmlAttributes tak, że mogę powiedzieć, że moją klasę css i parametr ciągu kwerendy?

Odpowiedz

4

Użyj following overload z BeginForm.

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