1
I have my Model as follows
public class Album {
public int Id {get;set;}
public int ArtistaId {get;set;}
}
public class Artista {
public int Id {get;set;}
}
And in my view, I use:
@Html.TextBoxFor(model => model.ArtistaId, new { @class = "form-control" })
Problem:
I wanted to use a AutoComplete
, for him to seek and set the ArtistaId
.
But as he is a "Id
", and when filling this TextBox
, he informs on ValidationMessage
that the field accepts only numerical data
thanks for the answer, good, after much and much reading, I removed the Repospository and service =), and as in this case I have not Viewmodel(removed too) I did not know how to solve. Enjoying, happy new year =)
– Rod
@Rod Viewmodel need not remove. Happy New Year!
– Leonel Sanches da Silva
I only saw utility in Viewmodel, in some models, in many was only "duplication" of code...used Automapper, Now for the Grids return a DTO which is "almost the same thing"
– Rod