I’m new in .NET development and need some help.
I need to display stars in function of a rating. This display will appear in most of my pages into the code.
So, I think that the best way to handle this is using a partial view.
After a few researches, I’ve found something that should enable me to send this parameter to the partial view.
For example, by calling the partial view like that
@Html.Partial("~/Views/Search/_SearchPartial.vbhtml", model.contact.rating)
But, I don’t know how to catch this parameter inside the partial view. Furthermore, the context won’t ever be the same. Sometimes, the stars that I’ll have to display will be from another rating. Does it change something?
When you pass the rating to the partial view you can access it via the
Modelobject inside the partial viewFor the view to know the type of the model it is dealing with you need to specify the type at the top of your partial view:
All this assumes that the rating object will always be of the same type. If you have different rating objects, then you will either need to parse them into a single type, or create one view for every type of rating object.