Pregunta

In my POCO model, I have a collection property defined as

    public virtual ICollection<Position> Positions { get; set; }

Now, in my jquery tmpl, I'd like to show the count of Positions property in a jquery tmpl like

        <span class="Position">${Positions.Count}</span>

However, it shows nothing (empty) there. I don't get any error either. Is there a way to make it work?

¿Fue útil?

Solución

add the method like:

public virtual ICollection<Position> Positions { get; set; }
public int Total { get { this.Positions.Count(); }

in your code

<span class="Position">${Total}</span>
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top