我有一个Repeater,它列出web.sitemap了ASP.NET 页面上的所有子页面。它DataSource是一个SiteMapNodeCollection. 但是,我不希望我的注册表单页面出现在那里。
Dim Children As SiteMapNodeCollection = SiteMap.CurrentNode.ChildNodes
'remove registration page from collection
For Each n As SiteMapNode In SiteMap.CurrentNode.ChildNodes
If n.Url = "/Registration.aspx" Then
Children.Remove(n)
End If
Next
RepeaterSubordinatePages.DataSource = Children
该SiteMapNodeCollection.Remove()方法抛出一个
NotSupportedException:“集合是只读的”。
如何在 DataBinding 中继器之前从集合中删除节点?