I have a nice HTML form that I want to use in a ASP.NET MVC application.
I created a method in controller to get the data via Formcollection and put it into database.
So far so good.
All the tutorials I see work the other way round, i.e. they create the form from the controller.
But I want to get data from html form. How can it be done?
Say I have this form:
<form class="form-horizontal">
<fieldset>
<!-- Form Name -->
<legend>Form Name</legend>
<!-- Multiple Radios -->
<div class="form-group">
<label class="col-md-4 control-label" for="radios">Multiple Radios</label>
<div class="col-md-4">
<div class="radio">
<label for="radios-0">
<input type="radio" name="radios" id="radios-0" value="1" checked="checked">
Option one
</label>
</div>
<div class="radio">
<label for="radios-1">
<input type="radio" name="radios" id="radios-1" value="2">
Option two
</label>
</div>
</div>
</div>
<!-- Textarea -->
<div class="form-group">
<label class="col-md-4 control-label" for="textarea">Text Area</label>
<div class="col-md-4">
<textarea class="form-control" id="textarea" name="textarea">default text</textarea>
</div>
</div>
</fieldset>
</form>
I want to take the data entered by the user (I want to modify the form such that I can access it from the controller) and put it into database, how can it be accomplished by first passing the data into the controller method?
from html form? Is there any other forms?