Here is the code in my view for users ratings display:
<div class="leftBlock">
<div class="leftBlockHead">
<div class="textHead">
<b>Users rating</b>
</div>
</div>
<div id="leftBlockContent">
@foreach (var user in Model)
{
<div class="list">
@user.Login @user.Rating
</div>
}
</div>
</div>
The problem is I use the same html structure for some other blocks. So I don't want to repeat this code, I need some kind of template which will take block title and @foreach as arguments. What are the ways to implement it?
You can look at creating HTMLHelper class extension methods to do such rendering.
You can also use the HTMLHelper RenderPartial method. For this you need to define
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With