本文整理汇总了C#中System.Web.UI.WebControls.TreeNode.Expand方法的典型用法代码示例。如果您正苦于以下问题:C# TreeNode.Expand方法的具体用法?C# TreeNode.Expand怎么用?C# TreeNode.Expand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.UI.WebControls.TreeNode
的用法示例。
在下文中一共展示了TreeNode.Expand方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: buildApplicationsTreeView
protected internal TreeNode buildApplicationsTreeView()
{
if (this.applications != null && this.applications.Length > 0)
{
this.storage.OpenConnection();
this.itemsHierarchyTreeView.Nodes.Clear();
TreeNode root = new TreeNode("NetSqlAzMan", "NetSqlAzMan", this.getImageUrl("NetSqlAzMan_16x16.gif"));
root.ToolTip = ".NET Sql Authorization Manager";
this.itemsHierarchyTreeView.Nodes.Add(root);
TreeNode storeNode = new TreeNode(this.applications[0].Store.Name, this.applications[0].Store.Name, this.getImageUrl("Store_16x16.gif"));
root.ChildNodes.Add(storeNode);
root.Expand();
storeNode.Expand();
storeNode.ToolTip = this.applications[0].Store.Description;
for (int i = 0; i < this.applications.Length; i++)
{
this.add(storeNode, this.applications[i]);
storeNode.Expand();
}
this.storage.CloseConnection();
root.Expand();
storeNode.Expand();
return root;
}
else
{
return null;
}
}
示例2: BindTreeView
public void BindTreeView(IEnumerable<Opcion> optionList, TreeNode parentNode)
{
var opcions =
optionList.Where(x => parentNode == null
? x.ParentID == 0
: x.ParentID == int.Parse(parentNode.Value));
if (_pagemode != BoPage.PageMode.View)
{
foreach (Opcion opcion in opcions)
{
var newNode = CreateTreeNode(opcion);
if (parentNode == null)
{
TreeViewPalabrasClaveOpciones.Nodes.Add(newNode);
}
else
{
if (opcion.PalabrasClaveOpciones.Where(c => c.KeywordID == _idKeyWord).Count() > 0)
{
newNode.Checked = true;
parentNode.Expand();
}
parentNode.ChildNodes.Add(newNode);
}
BindTreeView(optionList, newNode);
}
}
else
{
foreach (Opcion opcion in opcions)
{
if (ExistKeyWord(opcion))
{
var newNode = CreateTreeNode(opcion);
if (parentNode == null)
{
TreeViewPalabrasClaveOpciones.Nodes.Add(newNode);
}
else
{
if (opcion.PalabrasClaveOpciones.Where(c => c.KeywordID == _idKeyWord).Count() > 0)
{
newNode.Checked = true;
parentNode.Expand();
}
if (opcion.PalabrasClaveOpciones.Where(c => c.KeywordID == _idKeyWord).Count() > 0)
{
parentNode.ChildNodes.Add(newNode);
}
}
BindTreeView(optionList, newNode);
}
}
}
}
示例3: buildApplicationsTreeView
protected internal void buildApplicationsTreeView()
{
this.application.Store.Storage.OpenConnection();
this.itemsHierarchyTreeView.Nodes.Clear();
TreeNode root = new TreeNode("NetSqlAzMan", "NetSqlAzMan", this.getImageUrl("NetSqlAzMan_16x16.gif"));
root.ToolTip = ".NET Sql Authorization Manager";
this.itemsHierarchyTreeView.Nodes.Add(root);
TreeNode storeNode = new TreeNode(this.application.Store.Name, this.application.Store.Name, this.getImageUrl("Store_16x16.gif"));
root.ChildNodes.Add(storeNode);
root.Expand();
storeNode.Expand();
storeNode.ToolTip = this.application.Store.Description;
this.add(storeNode, this.application);
storeNode.Expand();
this.application.Store.Storage.CloseConnection();
root.Expand();
storeNode.Expand();
}
示例4: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
WestgateEntities db = new WestgateEntities();
if (IsPostBack == false)
{
TreeNode categoriesNode = new TreeNode("Tags");
categoriesNode.NavigateUrl = "~/Admin/TagsList.aspx";
categoriesNode.Expand();
List<Tag> listTags = (from t in db.Tags orderby t.Name select t).ToList();
foreach (Tag tag in listTags)
{
TreeNode catNode = new TreeNode(tag.Name,tag.TagId.ToString());
catNode.NavigateUrl = "~/Admin/EditTag.aspx?tagId=" + tag.TagId;
catNode.CollapseAll();
categoriesNode.ChildNodes.Add(catNode);
}
tvStructure.Nodes.Add(categoriesNode);
tvStructure.Nodes.Add(new TreeNode("Add New Image", "Add New Image", "", "~/Admin/AddImageNew.aspx", ""));
tvStructure.Nodes.Add(new TreeNode("Gallery", "Gallery", "", "~/Admin/Gallery.aspx", ""));
tvStructure.Nodes.Add(new TreeNode("Order Tags", "Order Tags", "", "~/Admin/OrderTags.aspx", ""));
}
}
示例5: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
WestgateEntities DatabaseContext = new WestgateEntities();
Repeater1.DataSource = (from row in DatabaseContext.Tags where row.ShowInTabs orderby row.OrderNumber select row).Take(7);
Repeater1.DataBind();
if (IsPostBack == false)
{
TreeNode categoriesNode = new TreeNode("All");
categoriesNode.NavigateUrl = "~/Gallery.aspx";
categoriesNode.Expand();
List<Tag> listTags = (from t in DatabaseContext.Tags orderby t.Name select t).ToList();
foreach (Tag tag in listTags)
{
TreeNode catNode = new TreeNode(tag.Name, tag.TagId.ToString());
catNode.NavigateUrl = "~/Gallery.aspx?tagId=" + tag.TagId;
catNode.CollapseAll();
categoriesNode.ChildNodes.Add(catNode);
}
tvStructure.Nodes.Add(categoriesNode);
}
}
示例6: PopulateCategories
void PopulateCategories()
{
SqlCommand sqlQuery = new SqlCommand(
"Select Cat_ID, CatName from TB_Cat_Product");
DataSet resultSet;
resultSet = RunQuery(sqlQuery);
if (resultSet.Tables.Count > 0)
{
foreach (DataRow row in resultSet.Tables[0].Rows)
{
TreeNode NewNode = new
TreeNode(row["CatName"].ToString(),
row["Cat_ID"].ToString());
//NewNode.PopulateOnDemand = true;
if (row["Cat_ID"].ToString().Equals(StrCatID) && !string.IsNullOrEmpty(StrCatID))
{
NewNode.Expand();
}
else
{
NewNode.Collapse();
}
NewNode.SelectAction = TreeNodeSelectAction.Expand;
PopulateSubCategories(NewNode);
//node.ChildNodes.Add(NewNode);
TreeView1.Nodes.Add(NewNode);
}
}
}
示例7: add
private void add(TreeNode parent, IAzManApplication app)
{
TreeNode node = new TreeNode(app.Name, app.Name, this.getImageUrl("Application_16x16.gif"));
node.ToolTip = app.Description;
parent.ChildNodes.Add(node);
node.Expand();
foreach (IAzManItem item in app.Items.Values)
{
if (item.ItemType == ItemType.Role)
{
if (item.ItemsWhereIAmAMember.Count == 0) this.AddRole(node, item, node);
}
}
foreach (IAzManItem item in app.Items.Values)
{
if (item.ItemType == ItemType.Task)
{
if (item.ItemsWhereIAmAMember.Count == 0) this.AddTask(node, item, node);
}
}
if (app.Store.Storage.Mode == NetSqlAzManMode.Developer)
{
foreach (IAzManItem item in app.Items.Values)
{
if (item.ItemType == ItemType.Operation)
{
if (item.ItemsWhereIAmAMember.Count == 0) this.AddOperation(node, item, node);
}
}
}
node.Collapse();
}
示例8: ShowSiteCollection
private void ShowSiteCollection(IEnumerable<SPSite> sites)
{
foreach (SPSite site in sites)
{
using (site)
{
var rootWeb = site.RootWeb;
var node = new TreeNode(rootWeb.Title, rootWeb.Url);
if (rootWeb.Url == currentWeb.Url)
{
node.Selected = true;
}
if (rootWeb.Webs.Count > 0)
{
ShowWebCollection(
rootWeb.Webs,
(title, url, rootNode) =>
{
var childNode = new TreeNode(title, new Uri(new Uri(site.Url), url).ToString());
if (currentWeb.Url.Contains(url))
{
childNode.Selected = true;
childNode.Expand();
}
rootNode.ChildNodes.Add(childNode);
return childNode;
},
node);
}
siteCollectionTree.Nodes.Add(node);
}
}
}
示例9: recurseSOATree
private TreeNode[] recurseSOATree(SOA soa)
{
string strCPU = null;
string strWCF = null;
string strASPNET = null;
if (soa.ConnectedSOAs == null || soa.ConnectedSOAs.Count == 0)
return null;
TreeNode[] returnNodes = new TreeNode[soa.ConnectedSOAs.Count];
for (int i = 0; i < soa.ConnectedSOAs.Count; i++)
{
int imageIndex = 0;
if (soa.ConnectedSOAs[i].Status.Equals(ConfigSettings.MESSAGE_CIRCULAR_REF_TERMINAL))
imageIndex = 3;
else
if (soa.ConnectedSOAs[i].Status.Equals(ConfigSettings.MESSAGE_OFFLINE))
imageIndex = 1;
string rootName = "<span><Font color='#84BDEC'>" + soa.ConnectedSOAs[i].SOAName + "</font></span>";
TreeNode root = new TreeNode(rootName, imageIndex.ToString(), imageList[imageIndex]);
root.ToolTip = "Connected Service Domain";
root.Expand();
imageIndex = 0;
int offset = 0;
string prefix = "";
string deployment = "";
string display="";
if (soa.ConnectedSOAs[i].MyVirtualHost != null)
{
if (soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes != null && soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes.Count > 0 && soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[0] != null)
{
if (soa.ConnectedSOAs[i].MyVirtualHost.Status == ConfigSettings.MESSAGE_OFFLINE)
offset = 0;
else
{
if (soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[0].RuntimePlatform!=null && soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[0].RuntimePlatform.ToLower().Contains("azure"))
{
offset = 1;
prefix = "Azure Platform Cloud Deployed ";
}
else
if (soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[0].RuntimePlatform != null && soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[0].RuntimePlatform.ToLower().Contains("hyper"))
{
offset = 2;
prefix = "On-premise Deployed (Hyper-V) ";
}
else
{
offset = 0;
prefix = "On-premise Deployed ";
}
}
}
if (soa.ConnectedSOAs[i].MyVirtualHost.Status == ConfigSettings.MESSAGE_ONLINE)
imageIndex = 4 + offset;
else
if (soa.ConnectedSOAs[i].MyVirtualHost.Status == ConfigSettings.MESSAGE_OFFLINE)
imageIndex = 7 + offset;
else
if (soa.ConnectedSOAs[i].MyVirtualHost.Status == ConfigSettings.MESSAGE_SOME_NODES_DOWN)
imageIndex = 10 + offset;
TreeNode myVHost = new TreeNode(prefix + soa.ConnectedSOAs[i].MyVirtualHost.VHostName, imageIndex.ToString(), imageList[imageIndex]);
myVHost.Expand();
TreeNode[] clusterNodes = new TreeNode[soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes.Count];
for (int h = 0; h < soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes.Count; h++)
{
TreeNode primaryEPs = new TreeNode("", "23", imageList[23]);
primaryEPs.ToolTip = "Primary Endpoints are those defined by the business application developer to service business requests via their custom business logic.";
primaryEPs.Collapse();
TreeNode configEPs = new TreeNode("", "22", imageList[22]);
configEPs.ToolTip = "Configuration Service Endpoints are infrastructure endpoints available for the Configuration Service itself, for example an endpoint to which ConfigWeb connects.";
configEPs.Collapse();
// TreeNode dcEPs = new TreeNode("", "24", imageList[24]);
// dcEPs.Collapse();
TreeNode[] endPointNodesPrimary = new TreeNode[soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].PrimaryListenEndpoints.Count];
TreeNode[] endPointNodesConfig = new TreeNode[soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].ConfigServiceListenEndpoints.Count];
// TreeNode[] endPointNodesDC = new TreeNode[soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].DCServiceListenEndpoints.Count];
for (int j = 0; j < soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].PrimaryListenEndpoints.Count; j++)
{
string NAT = "";
string NAT2 = "";
int endPointImageIndex = 0;
switch (soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].PrimaryListenEndpoints[j].Status)
{
case ConfigSettings.MESSAGE_ONLINE: { endPointImageIndex = 25; break; }
case ConfigSettings.MESSAGE_OFFLINE: { endPointImageIndex = 26; break; }
case ConfigSettings.MESSAGE_UNKNOWN: { endPointImageIndex = 27; break; }
}
if (soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].PrimaryListenEndpoints[j].LoadBalanceType.Equals(1))
{
NAT = "<span style=\"color:#FFFFFF\"> --> {" + soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].PrimaryListenEndpoints[j].LoadBalanceAddress + "}</span>";
NAT2 = "<span style=\"color:#FFFFFF\"> --> {NAT Load-Balanced}</span>";
}
TreeNode endpointnode = null;
if (CheckBoxEndpointDetail.Checked)
{
endpointnode = new TreeNode("<span style=\"color:#848483;\">" + soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].PrimaryListenEndpoints[j].RemoteAddress + "</span>" + NAT, endPointImageIndex.ToString(), imageList[endPointImageIndex]);
}
else
{
endpointnode = new TreeNode("<span style=\"color:#848483;\">" +soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].PrimaryListenEndpoints[j].ServiceFriendlyName + "</span>" + NAT2, endPointImageIndex.ToString(), imageList[endPointImageIndex]);
//.........这里部分代码省略.........
示例10: Add_Controls
//.........这里部分代码省略.........
folderNode.ImageToolTip = "Public folder";
}
else
{
folderNode.ImageUrl = Static_Resources_Gateway.Open_Folder_Jpg;
}
folderNode.Text = " <span class=\"Selected_TreeNode_Text\">" + thisFolder.Folder_Name + "</span>";
folderNode.SelectAction = TreeNodeSelectAction.None;
}
else
{
if (thisFolder.IsPublic)
{
folderNode.ImageUrl = Static_Resources_Gateway.Closed_Folder_Public_Jpg;
folderNode.ImageToolTip = "Public folder";
}
else
{
folderNode.ImageUrl = Static_Resources_Gateway.Closed_Folder_Jpg;
}
folderNode.Text = " <a href=\"" + redirect_url.Replace("XXXXXXXXXXXXXXXXXX", thisFolder.Folder_Name_Encoded) + "\">" + thisFolder.Folder_Name + "</a>";
}
rootNode.ChildNodes.Add(folderNode);
// Add all the children nodes as well
add_children_nodes(folderNode, thisFolder, properFolderName, redirect_url, selectedNodes);
}
}
// Collapse the treeview
treeView1.CollapseAll();
if (selectedNodes.Count > 0)
{
TreeNode selectedNodeExpander = selectedNodes[0];
while (selectedNodeExpander.Parent != null)
{
(selectedNodeExpander.Parent).Expand();
selectedNodeExpander = selectedNodeExpander.Parent;
}
}
else
{
rootNode.Expand();
}
MainPlaceHolder.Controls.Add(treeView1);
}
if (RequestSpecificValues.Current_Mode.My_Sobek_SubMode.Length > 0)
{
if ( RequestSpecificValues.Results_Statistics.Total_Titles == 0)
{
Literal literal = new Literal();
string folder_name = RequestSpecificValues.Current_User.Folder_Name(RequestSpecificValues.Current_Mode.My_Sobek_SubMode);
RequestSpecificValues.Current_Mode.My_Sobek_SubMode = String.Empty;
if (folder_name.Length == 0)
{
UrlWriterHelper.Redirect(RequestSpecificValues.Current_Mode);
return;
}
if (properFolderName != "Submitted Items")
literal.Text = "<br /><br /><h1>" + folder_name + "</h1><br /><br /><div class=\"SobekHomeText\" ><center><b>This bookshelf is currently empty</b></center><br /><br /><br /></div></div>";
else
literal.Text = "<h1>" + folder_name + "</h1><br /><br /><div class=\"SobekHomeText\" ><center><b>This bookshelf is currently empty</b></center><br /><br /><br /></div></div>";
示例11: ExpandToRoot
private void ExpandToRoot(TreeNode node)
{
if (node != null)
{
node.Expand();
if (node.Parent != null)
{
ExpandToRoot(node.Parent);
}
}
}
示例12: Build_Tree
//.........这里部分代码省略.........
lastNode2.ChildNodes.Add(singleNode3);
}
else
{
if ((lastNode3 == null) || (lastNodeText3 != level3_text.ToUpper()))
{
lastNode3 = new TreeNode(level3_text);
if (level3_text.Length > LINE_TO_LONG)
{
lastNode3.ToolTip = lastNode3.Text;
lastNode3.Text = level3_text.Substring(0, LINE_TO_LONG) + "...";
}
lastNode3.SelectAction = TreeNodeSelectAction.None;
lastNodeText3 = level3_text.ToUpper();
lastNode2.ChildNodes.Add(lastNode3);
lastNode4 = null;
lastNodeText4 = String.Empty;
}
}
}
// Look at the fourth level
if ((level4_text.Length > 0) && (lastNode3 != null))
{
UI_ApplicationCache_Gateway.Translation.Get_Translation(thisItem.Level5_Text, currentRequest.Language);
if (level5_text.Length == 0)
{
TreeNode singleNode4 = new TreeNode(access_span_start + level4_text + access_string + access_span_end);
if (level4_text.Length > LINE_TO_LONG)
{
singleNode4.ToolTip = level4_text;
level4_text = level4_text.Substring(0, LINE_TO_LONG) + "...";
singleNode4.Text = access_span_start + level4_text + access_string + access_span_end;
}
if (thisItem.ItemID == briefItem.Web.ItemID)
{
currentSelectedNode = singleNode4;
singleNode4.SelectAction = TreeNodeSelectAction.None;
singleNode4.Text = "<span id=\"sbkMviv_TreeSelectedNode\">" + level4_text + access_string + "</span>";
}
else
{
singleNode4.NavigateUrl = redirect_url.Replace("<%VID%>", thisItem.VID);
}
lastNode3.ChildNodes.Add(singleNode4);
}
else
{
if ((lastNode4 == null) || (lastNodeText4 != level4_text.ToUpper()))
{
lastNode4 = new TreeNode(level4_text);
if (level4_text.Length > LINE_TO_LONG)
{
lastNode4.ToolTip = lastNode4.Text;
lastNode4.Text = level4_text.Substring(0, LINE_TO_LONG) + "...";
}
lastNode4.SelectAction = TreeNodeSelectAction.None;
lastNodeText4 = level4_text.ToUpper();
lastNode3.ChildNodes.Add(lastNode4);
}
}
}
// Look at the fifth level
if ((level5_text.Length > 0) && (lastNode4 != null))
{
TreeNode lastNode5 = new TreeNode(access_span_start + level5_text + access_string + access_span_end);
if (level5_text.Length > LINE_TO_LONG)
{
lastNode5.ToolTip = level5_text;
level5_text = level5_text.Substring(0, LINE_TO_LONG) + "...";
lastNode5.Text = access_span_start + level5_text + access_string + access_span_end;
}
if (thisItem.ItemID == briefItem.Web.ItemID)
{
currentSelectedNode = lastNode5;
lastNode5.SelectAction = TreeNodeSelectAction.None;
lastNode5.Text = "<span id=\"sbkMviv_TreeSelectedNode\">" + level5_text + access_string + "</span>";
}
else
{
lastNode5.NavigateUrl = redirect_url.Replace("<%VID%>", thisItem.VID);
}
lastNode4.ChildNodes.Add(lastNode5);
}
}
}
rootNode.CollapseAll();
rootNode.Expand();
if (currentSelectedNode == null) return;
while ((currentSelectedNode != rootNode) && (currentSelectedNode != null))
{
currentSelectedNode.Expand();
currentSelectedNode = currentSelectedNode.Parent;
}
}
示例13: CreateTreeNodes
void CreateTreeNodes()
{
NavigationTree = new TreeView();
NavigationTree.ID = "NavigationTree";
NavigationTree.ShowLines = this.ShowLines;
NavigationTree.ExpandDepth = _ExpandDepth;
try
{
SPList list = base.GetCurrentSPList();
if (list == null) return;
SPView view = base.CurrentView;
SPFolder rootFolder = list.RootFolder;
string pageUrl = Page.Request.RawUrl;
if (pageUrl.IndexOf("?") != -1)
pageUrl = pageUrl.Split('?')[0];
pageUrl += "?RootFolder=";
string currentUrl = Page.Request.QueryString["RootFolder"];
string webUrl = base.GetCurrentSPWeb().ServerRelativeUrl;
if (!webUrl.EndsWith("/"))
webUrl += "/";
//root
TreeNode rootNode = new TreeNode();
rootNode.ImageUrl = "/_layouts/images/folder.gif";
rootNode.Expand();
rootNode.Text = list.Title;
rootNode.NavigateUrl = "";
NavigationTree.Nodes.Add(rootNode);
if (EnableCallback)
{
string serverCallJs = Page.ClientScript.GetCallbackEventReference(this, "args", "TreeListViewWebPart_Callback", "context", "TreeListViewWebPart_Callback", true);
pageUrl = getCurrentPageName(pageUrl);
string clientBackJs = "function TreeListViewWebPart_Callback(rvalue, context){document.getElementById('" + this.ClientID + "__FolderContent').innerHTML=rvalue;}\n";
//encodeURIComponent��moss����js����
string serverCallJsWrap = "function TreeListViewWebPart_LoadFolderContent( page , folder ){ theForm.action= page + encodeURIComponent(folder);" +
"var args = '';var context='';document.getElementById('" + this.ClientID + "__FolderContent').innerHTML='Loading...';" +
serverCallJs + " ;}\n";
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", serverCallJsWrap + clientBackJs, true);
rootNode.NavigateUrl = String.Format("javascript:TreeListViewWebPart_LoadFolderContent('{0}','{1}')", pageUrl, (webUrl + rootFolder.Url));
buildAsyncSub(pageUrl, webUrl, rootFolder, rootNode.ChildNodes);
}
else
{
rootNode.NavigateUrl = pageUrl + Page.Server.UrlEncode(webUrl + rootFolder.Url);
this.buildSub(pageUrl, webUrl, currentUrl, rootFolder, rootNode.ChildNodes);
}
this.Controls.Add(NavigationTree);
}
catch (Exception ex)
{
base.RegisterError(ex);
}
}
示例14: List
public void List(WebLegend tree, ServerLayer l = null, TreeNode parent = null)
{
if (l == null)
{
TreeNode tn = new TreeNode(_layer.Title);
tn.ShowCheckBox = true;
tn.Checked = _layer.visible;
tn.Expand();
if (_layer.Style != null)
{
if (_layer.Style.Count() > 0)
{
if (_layer.Style[0].LegendUrl.OnlineResource.OnlineResource != "")
{
tn.ImageUrl = _layer.Style[0].LegendUrl.OnlineResource.OnlineResource;
}
}
List(tree, _layer, tn);
}
tree.Nodes.Add(tn);
}
else
{
//foreach (WmsServerLayer cl in l.ChildLayers)
for (int i = l.ChildLayers.Count() - 1; i >= 0; i--)
{
ServerLayer cl = l.ChildLayers[i];
TreeNode tn = new TreeNode(cl.Title);// + " " + cl.Name);
tn.ShowCheckBox = true;
tn.Checked = cl.visible;
List(tree, cl, tn);
tn.Expand();
parent.ChildNodes.Add(tn);
}
}
}
示例15: treeElem_OnNodeCreated
/// <summary>
/// Invoked when new tree node is created.
/// </summary>
/// <param name="itemData">Category data.</param>
/// <param name="defaultNode">Default node.</param>
protected TreeNode treeElem_OnNodeCreated(DataRow itemData, TreeNode defaultNode)
{
defaultNode.Selected = false;
defaultNode.SelectAction = TreeNodeSelectAction.None;
defaultNode.NavigateUrl = "";
if (itemData != null)
{
CategoryInfo category = new CategoryInfo(itemData);
var catLevel = category.CategoryLevel;
if ((StartingCategoryObj != null) && (category.CategoryIDPath.StartsWithCSafe(StartingCategoryObj.CategoryIDPath)))
{
catLevel -= StartingCategoryObj.CategoryLevel - 1;
}
string cssClass = GetCssClass(catLevel);
string caption = category.CategoryDisplayName;
if (String.IsNullOrEmpty(caption))
{
caption = category.CategoryName;
}
// Get target URL
string url = GetUrl(category);
caption = HTMLHelper.HTMLEncode(ResHelper.LocalizeString(caption));
StringBuilder attrs = new StringBuilder();
// Append target attribute
if (!string.IsNullOrEmpty(CategoriesPageTarget))
{
attrs.Append(" target=\"").Append(CategoriesPageTarget).Append("\"");
}
// Append title attribute
if (RenderLinkTitle)
{
attrs.Append(" title=\"").Append(caption).Append("\"");
}
// Append CSS class
if (!string.IsNullOrEmpty(cssClass))
{
attrs.Append(" class=\"" + cssClass + "\"");
}
// Append before/after texts
caption = (CategoryContentBefore ?? "") + caption;
caption += CategoryContentAfter ?? "";
if (category.IsGlobal && !category.CategoryIsPersonal)
{
caption += " <sup>" + GetString("general.global") + "</sup>";
}
// Set caption
defaultNode.Text = defaultNode.Text.Replace("##NODECUSTOMNAME##", caption);
defaultNode.Text = defaultNode.Text.Replace("##NODECODENAME##", HTMLHelper.HTMLEncode(category.CategoryName));
defaultNode.Text = defaultNode.Text.Replace("##PARENTID##", category.CategoryParentID.ToString());
defaultNode.Text = defaultNode.Text.Replace("##ID##", category.CategoryID.ToString());
defaultNode.Text = defaultNode.Text.Replace("##BEFORENAME##", string.Format("<a href=\"{0}\" {1}>", HTMLHelper.EncodeForHtmlAttribute(url), attrs));
defaultNode.Text = defaultNode.Text.Replace("##AFTERNAME##", "</a>");
// Expand node if all nodes are to be expanded
if (ExpandAll)
{
defaultNode.Expand();
}
else
{
// Check if selected category exists
if (Category != null)
{
if ((Category.CategoryID != category.CategoryID) || RenderSubItems)
{
// Expand whole path to selected category
string strId = category.CategoryID.ToString().PadLeft(CategoryInfoProvider.CategoryIDLength, '0');
if (Category.CategoryIDPath.Contains(strId))
{
defaultNode.Expand();
}
}
}
}
return defaultNode;
}
return null;
}