本文整理匯總了C#中System.Web.UI.WebControls.MenuItem.Bind方法的典型用法代碼示例。如果您正苦於以下問題:C# MenuItem.Bind方法的具體用法?C# MenuItem.Bind怎麽用?C# MenuItem.Bind使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Web.UI.WebControls.MenuItem
的用法示例。
在下文中一共展示了MenuItem.Bind方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: PerformDataBinding
protected internal override void PerformDataBinding ()
{
base.PerformDataBinding ();
HierarchicalDataSourceView data = GetData ("");
IHierarchicalEnumerable e = data.Select ();
foreach (object obj in e) {
IHierarchyData hdata = e.GetHierarchyData (obj);
MenuItem item = new MenuItem ();
item.Bind (hdata);
Items.Add (item);
OnMenuItemDataBound (new MenuEventArgs (item));
}
}
示例2: FillBoundChildren
void FillBoundChildren ()
{
items = new MenuItemCollection (this);
if (hierarchyData == null || !hierarchyData.HasChildren) return;
IHierarchicalEnumerable e = hierarchyData.GetChildren ();
foreach (object obj in e) {
IHierarchyData hdata = e.GetHierarchyData (obj);
MenuItem item = new MenuItem ();
item.Bind (hdata);
items.Add (item);
}
}
示例3: FillBoundChildrenRecursive
void FillBoundChildrenRecursive (IHierarchicalEnumerable hEnumerable, MenuItemCollection itemCollection)
{
if (hEnumerable == null)
return;
foreach (object obj in hEnumerable) {
IHierarchyData hdata = hEnumerable.GetHierarchyData (obj);
MenuItem item = new MenuItem ();
itemCollection.Add (item);
item.Bind (hdata);
SiteMapNode siteMapNode = hdata as SiteMapNode;
if (siteMapNode != null) {
if (_currSiteMapNode == null)
_currSiteMapNode = siteMapNode.Provider.CurrentNode;
if (siteMapNode == _currSiteMapNode)
item.Selected = true;
}
OnMenuItemDataBound (new MenuEventArgs (item));
if (hdata == null || !hdata.HasChildren)
continue;
IHierarchicalEnumerable e = hdata.GetChildren ();
FillBoundChildrenRecursive (e, item.ChildItems);
}
}