I am fairly new to .NET and I am trying to get mt head wrapped around some simple form and validation syntax stuff.
I have a model ContactUs.cs which looks like this
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Presentation.Web.Models.FormModels
{
public class ContactUs
{
public String name { get; set; }
public String email { get; set; }
public String comment { get; set; }
}
}
And my razor looks like this
@using(Html.BeginForm()){
<div class='form-group'>
<div class='row'>
<div class='col-md-3'>
<label class='control-label'>Your Name</label>
<input class='form-control' placeholder='your username' type='text'>
</div>
<div class='col-md-3'>
<label class='control-label'>Your Email</label>
<input class='form-control' placeholder='your password' type='text'>
</div>
</div>
</div>
<div class='form-group'>
<div class='row'>
<div class='col-md-6'>
<label class='control-label'>Your Message</label>
<textarea class='form-control' name='' rows='4'></textarea>
</div>
</div>
</div>
}
<input type="button" ID="sumbmit-contact-us" runat="server" name="Save" value="SUMBMIT"/>
I am struggling to figure out how to dynamically print the label and do validation check on submit. Also if I end up adding this into the HomeController.cs then How should the syntax look like?