HTML and CSS Reference
In-Depth Information
namespace Chapter 3 .Models
{
public class FeedbackModel
{
[Display(Name = "Name", Prompt = "Enter your full name"),
Required]
public string Name { get; set; }
[Display(Name = "Average Score", Prompt = "Your average score"),
Range(1.0, 100.0),
Required]
public decimal Score { get; set; }
[Display(Name = "Birthday"),
DataType(DataType.Date)]
public DateTime? Birthday { get; set; }
[Display(Name = "Home page", Prompt = "Personal home page"),
DataType(DataType.Url),
Required]
public string Homepage { get; set; }
[Display(Name = "Email", Prompt = "Preferred e-mail address"),
DataType(DataType.EmailAddress),
Required]
public string Email { get; set; }
[Display(Name = "Phone number", Prompt = "Contact phone number"),
DataType(DataType.PhoneNumber),
Required]
public string Phone { get; set; }
[Display(Name = "Overall Satisfaction")]
public string Satisfaction { get; set; }
}
}
Press F6 to build the application. This will make the model available when defining the view.
Defining the Feedback View
Now you'll define a new view based on this model. Initially, this will be a simple form with a single field. Then you
will add a link on the home page and a controller action to handle this. Later in the chapter you'll add more fields
to the form.
 
Search WWH ::




Custom Search