문제

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?

도움이 되었습니까?

해결책

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>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top