Pergunta

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?

Foi útil?

Solução

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 em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top