c# - Metadata in separate file does not display as expected -
Hi, I am trying to add my model to different files so that my model can be clearly cleaned, but something seems to be wrong because now it looks like some properties are not displayed. We do. Here are my model classes:
Public partial class BookModel {public int id {get; Set; } Public string name {get; Set; } Public String Writer {get; Set; } Public string description {get; Set;} Public Date Time Publication Date {get; Set; } Public Int Category IID {Received; Set; } Public decimal value {received; Set; } Public String BookUrl {get; Set; }} Here my metadata is a partial class:
[Metadata type (typef (bookmodel)] Public partial class BookModelMetada {Public Ent ID (get ; Set;} [required] Public string name {get; set;} [essential] public string author {get; set;} [required] [datatype (datatype multiline text)] public string description {get; set;} [Required] [DisplayFormat (DataFormatString = "{0: d}", ApplyFormatInEditMode = true)] Public Date Time Release Day ({Format:}} {Required} Public Int Category IID {Received; Set;} [Required] [DataType.Currency] [Display Format (Dataformat String = "{0: C}")] Public Decimal Value {Received; Set;} Public String BookUrl {get} Set;}} Strange area is that publishing and value verification display error but other properties. < P> What am I doing?
Edit: Look at the code: & lt; p & gt; @ Html.LabelFor (model = & gt; Model.Book.Name, "Book Name") @ Html.TextBoxFor (model => model.Book.Name) & lt; / P & gt; & Lt; P & gt; @ Html.LabelFor (model => model.book author) @ Html.TextBoxFor (model => model.book author) & lt; / P & gt; & Lt; P & gt; @ Html.LabelFor (model = & gt; model.Book.PublicationDate, "Publication Date") @ Html.TextBoxFor (model = & gt; model.book publication date, new {@ class = "datepicker"}) & lt ; / P & gt; & Lt; P & gt; @ Html.LabelFor (model = & gt; model.Book.Price) @ Html.TextBoxFor (model => model.Book.Price) & lt; / P & gt; & Lt; P & gt; @ Html.LabelFor (Model = & gt; model.Book.CategoryId, "Select Category") @ Html.DropDownListFor (Model => Model. Category IED, New Selection List (Model Categories, "ID", " Name ")) & lt; / P & gt; & Lt; P & gt; @htmllabelfor (model => model.book .description) @html. TextEfaf (model => Model.books .description) & lt; / P & gt; & Lt; P & gt; & Lt; Input type = "submit" value = "create" class = "link" /> @ Html.ActionLink ("back to list", "books", "product manager", blank, new {@class = "link"}) & lt; / P & gt;
The problem was that I got the code Metadata instead of model class.
Comments
Post a Comment