I m using Entity Framework, and have one view which is strongly type view model of type tblAuthorMaster. On Post ModelState returns me following error :
The value '0' is not valid for Status.
Here Status is of boolen datatype in DB/EF and on view it's dropdown (TEXT="active/inactive", VALUE="1/0"), so whenever i post my form i used to get the above error message.
I have tried some solution to overcome with this issue but it seems not wotking properly.
Following is my code base:
Here tblAuthorMaster is EF Class and AuthorModel is my Custom Class, which i m using for some custom validation and other stuff.
[MetadataType(typeof(AuthorModel))]
public partial class tblAuthorMaster { }
public class AuthorModel
{
[Required(ErrorMessage = "*")]
public string AuthorName { get; set; }
[Required(ErrorMessage = "*")]
public bool Status { get; set; }
}
Thanks in advance.