0

While in asp.net master page use to contain form control. I am not able to figure out, where is the correct location to place Html.BeginForm(). Is it Layout Page or the View.

Thank you for your help.

2 Answers 2

1

You should place one in any one location that you need a form. This normally means inside a view, as you would want a different action on each page/form rather than the same one across the site.

The limitation of one form per page that webforms has does not exist in MVC - you can have more than one form per page.

Sign up to request clarification or add additional context in comments.

5 Comments

Hi Oded, Using MVC 3, I have generated a strongly typed View. This contains 5-6 input fields (WCF Reqeust) and some output fields(WCF Response). Should I include response section also in Html.BeginForm()
@autrevo - I don't know. I have no idea what you are trying to do with your form and why you are exposing WCF data on your UI.
Hi Oded, I have a set of WCF services, For testing purposes, I am trying to create a simple MVC app, to invoke these serivces and display the result.
@autrevo - So, for input use a form. You don't have to have a form to display the output (and that should be a separate view anyways).
I have to display request and response, simultaneously. Partial view is the way to go, it seems in this case. Because I shall not be able to make a single strongly typed view with Request & Response togther.
1

Form element should wrap up your input elements and textarea's.
Thus if your inputs are in your layout or master page - you can have a form there.
But most of the time your forms are in your views, where you create or edit data.

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.