Question

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?

Was it helpful?

Solution

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>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top