Quote:
Originally Posted by flyinhawaiian
My code looks like this:
Code:
<%: Html.LabelFor(m => m.Country) %>
<%: Html.DropDownListFor(m => m.Country, Model.Countries) %>
<%: Html.ValidationMessageFor(m => m.Country, "*") %>
|
Thank you flyinhawaiian, but when I change the code the aplication is not able to perform any update (Edit.aspx) it always shows the following message:
Please correct the erros and try again.
The "DropDown" is in red color. Si I went to Dinner partial class and commented the following line:
Code:
namespace NerdDinner.Models
{
[MetadataType(typeof(Dinner_Validation))]
public partial class Dinner
{
//...
}
public class Dinner_Validation
{
[Required(ErrorMessage = "Title is required")]
[StringLength(50, ErrorMessage = "Title may not be longer than 50 characters")]
public string Title { get; set; }
[Required(ErrorMessage = "Description is required")]
[StringLength(265, ErrorMessage =
"Description must be 256 characters or less")]
public string Description { get; set; }
[Required(ErrorMessage = "Address is required")]
public string Address { get; set; }
//[Required(ErrorMessage = "Country is required")]
public string Country { get; set; }
[Required(ErrorMessage = "Phone# is required")]
public string ContactPhone { get; set; }
}
}
When I run the application it shows the same error.