Wednesday, May 27, 2009

Spawning a new window when a form is posted using Html.BeginForm

While it is not immediately evident, the following usage will spawn a new window displaying the results of a form post.


<%Using Html.BeginForm("Print", "Secure", Nothing, FormMethod.Post , New With {.target="_blank"})%>



Turns out that the form tag always included the target attribute, you just need to instruct the BeginForm helper to use it.

No comments:

Post a Comment