Thomas
Thomas

Reputation: 34188

ASP.Net MVC Form binding with Model sample

i am new in MVC and try to learning through googling & online tutorial. i search Form binding with Model sample in MVC and got many sample code but i am not getting a sample code for a complete form where all kind of html controls are used like

checkbox
radiobutton
listbox control
drodownlist
textarea
hiddenfields
checkboxlist
radiobuttonlist etc

and all controls should be bind through model with server side and client side both kind of validation. form should have two textbox one dropdown, 3 checkboxes and 2 radio button, one listbox control and if possible provide guide line to work with checkboxlist & radiolist.

if anyone knows that kind of url then plzz inform me or if possible please give me a sample code of a complete form where all the above controls will be there with model binding and validation. thanks

Upvotes: 0

Views: 3135

Answers (2)

Jatin patil
Jatin patil

Reputation: 4288

Have a look here:

It Explains, Rendering a Form in ASP.NET MVC Using HTML Helpers

http://msdn.microsoft.com/en-us/library/dd410596%28v=vs.100%29.aspx

http://stephenwalther.com/archive/2009/03/03/chapter-6-understanding-html-helpers

Upvotes: 0

Milad Hosseinpanahi
Milad Hosseinpanahi

Reputation: 1495

in the Views there is a helper called Html you can use it in the view like @Html

there are all things that you wanted, for example

@Html.HiddenFor

@Html.RadioButtonFor

@Html.TextAreaFor

and so on

search for asp.net mvc Html helpers

another smaple

@Html.CheckBox("sameName")
@Html.CheckBox("sameName")
@Html.CheckBox("sameName")
@Html.CheckBox("sameName")

it will produce this html

<input type="checkbox" name="sameName" />
<input type="checkbox" name="sameName" />
<input type="checkbox" name="sameName" />
<input type="checkbox" name="sameName" />

take a look at this website

Upvotes: 1

Related Questions