MS DynamicData 的 Children.ascx.cs 文件有一个Page_Load
方法可以返回一个超链接,上面写着“查看孩子”。我想将孩子的数量附加到超链接文本的末尾。下面是我的尝试。如何让超链接显示“查看儿童 - # 条目”?
protected void Page_Load(object sender, EventArgs e)
{
HyperLink1.Text = "View " + ChildrenColumn.ChildTable.DisplayName;
//The following code gives the total entries.
//How do I get the number of children only?
//int entries = 0;
//foreach (var entry in ChildrenColumn.ChildTable.GetQuery()) { entries++; }
//string entryText = (entries == 1) ? "entry" : "entries";
//HyperLink1.Text= HyperLink1.Text + " " + entries + " " + entryText;
}