本文整理汇总了C#中System.Web.UI.WebControls.TreeNode.CollapseAll方法的典型用法代码示例。如果您正苦于以下问题:C# TreeNode.CollapseAll方法的具体用法?C# TreeNode.CollapseAll怎么用?C# TreeNode.CollapseAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.UI.WebControls.TreeNode
的用法示例。
在下文中一共展示了TreeNode.CollapseAll方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
SelectAreas sa = new SelectAreas();
IList<Areas> areas = sa.GetAreas(Session["userid"].ToString());
foreach (Areas area in areas)
{
TreeNode tn = new TreeNode();
tn.Text = area.Area_Name;
tn.Value = area.ID.ToString();
//suburb
IList<Areas> suburbs = sa.Getsuburb(area.ID.ToString(), Session["userid"].ToString());
foreach (Areas suburb in suburbs)
{
TreeNode tv = new TreeNode();
tv.Text = suburb.Area_Name;
tv.Value = suburb.ID.ToString();
TreeNode node = new TreeNode();
node.Text = "";
tv.ChildNodes.Add(node);
tv.Expanded = false;
tv.CollapseAll();
tn.ChildNodes.Add(tv);
}
TreeView1.Nodes.Add(tn);
}
}
//SelectAreas sa = new SelectAreas();
//IList<Areas> areas = sa.GetAreas(Session["userid"].ToString());
//StringBuilder sb = new StringBuilder();
//foreach (Areas area in areas)
//{
// sb.Append("<li><span>" + area.Area_Name + "</span>");
// sb.Append("<ul>");
// //suburb
// IList<Areas> suburbs = sa.Getsuburb(area.ID.ToString(), Session["userid"].ToString());
// foreach (Areas suburb in suburbs)
// {
// sb.Append("<li id=\"" + suburb.ID.ToString() + "\" class=\"hasChildren\"><span>" + suburb.Area_Name + "</span>");
// sb.Append("<ul>");
// sb.Append("<li><span class=\"placeholder\"> </span></li>");
// sb.Append("</ul>");
// sb.Append("</li>");
// }
// sb.Append("</ul>");
// sb.Append("</li>");
//}
//ltlArea.Text = sb.ToString();
}
示例2: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack) {
using (ISession session = HibernateHelper.GetSession().OpenSession()) {
ITransaction transaction = session.BeginTransaction();
try {
List<Editor.BE.Model.Content> contList = new List<Editor.BE.Model.Content>();
contList = EditorServices.GetContents<Editor.BE.Model.Content>(session);
foreach (Editor.BE.Model.Content cnt in contList) {
TreeNode nodeContent = new TreeNode(cnt.Title, cnt.Contentid.ToString() + "|" + "0", "~/img/cont.gif");
nodeContent.Target = "mainFrame";
nodeContent.NavigateUrl = "EditContent.aspx?id="+cnt.Contentid;
//1 liv
var fist = (from f in cnt.Pages
where f.Pageid == f.Parentpageid
orderby f.Position ascending
select f);
foreach (Editor.BE.Model.Page pg in fist) {
TreeNode nodePage = new TreeNode(pg.Publictitle, cnt.Contentid.ToString() + "|" + pg.Pageid.ToString(), "~/img/cild.gif");
nodePage.Target = "mainFrame";
nodePage.NavigateUrl = "EditPage.aspx?id="+pg.Pageid;
nodeContent.ChildNodes.Add(nodePage);
}
//2 liv
var sec = (from f in cnt.Pages
join h in fist on f.Parentpageid equals h.Pageid
where f.Pageid != f.Parentpageid
orderby f.Position ascending
select f);
foreach (Editor.BE.Model.Page pg in sec) {
TreeNode nodePage = new TreeNode(pg.Publictitle, cnt.Contentid.ToString() + "|" + pg.Pageid.ToString(), "~/img/cild.gif");
foreach (TreeNode temp in nodeContent.ChildNodes) {
if (temp.Value == cnt.Contentid.ToString() + "|" + pg.Parentpageid.ToString()) {
nodePage.Target = "mainFrame";
nodePage.NavigateUrl = "EditPage.aspx?id="+pg.Pageid;
nodeContent.ChildNodes[nodeContent.ChildNodes.IndexOf(temp)].ChildNodes.Add(nodePage);
}
}
}
nodeContent.CollapseAll();
TreeView1.Nodes[0].ChildNodes.Add(nodeContent);
}
} catch (Exception ex) {
transaction.Rollback();
throw ex;
} finally {
session.Flush();
session.Close();
}
}
}
}
示例3: 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", ""));
}
}
示例4: 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);
}
}
示例5: 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))
{
translator.Get_Translation(thisItem[level5_text_column].ToString(), CurrentMode.Language);
if (level5_text.Length == 0)
{
TreeNode singleNode4 = new TreeNode(level4_text);
if (level4_text.Length > LINE_TO_LONG)
{
singleNode4.ToolTip = singleNode4.Text;
singleNode4.Text = level4_text.Substring(0, LINE_TO_LONG) + "...";
}
if (itemid == CurrentItem.Web.ItemID)
{
currentSelectedNode = singleNode4;
singleNode4.SelectAction = TreeNodeSelectAction.None;
singleNode4.Text = "<i>" + singleNode4.Text + "</i>";
}
else
{
singleNode4.NavigateUrl = redirect_url.Replace("<%VID%>", 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(level5_text);
if (level5_text.Length > LINE_TO_LONG)
{
lastNode5.ToolTip = lastNode5.Text;
lastNode5.Text = level5_text.Substring(0, LINE_TO_LONG) + "...";
}
if (itemid == CurrentItem.Web.ItemID)
{
currentSelectedNode = lastNode5;
lastNode5.SelectAction = TreeNodeSelectAction.None;
lastNode5.Text = "<i>" + lastNode5.Text + "</i>";
}
else
{
lastNode5.NavigateUrl = redirect_url.Replace("<%VID%>", vid);
}
lastNode4.ChildNodes.Add(lastNode5);
}
}
}
rootNode.CollapseAll();
rootNode.Expand();
if (currentSelectedNode == null) return;
while ((currentSelectedNode != rootNode) && ( currentSelectedNode != null ))
{
currentSelectedNode.Expand();
currentSelectedNode = currentSelectedNode.Parent;
}
}
示例6: 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))
{
translator.Get_Translation(thisItem[level5_text_column].ToString(), CurrentMode.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 (itemid == CurrentItem.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%>", 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 (itemid == CurrentItem.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%>", vid);
}
lastNode4.ChildNodes.Add(lastNode5);
}
}
}
rootNode.CollapseAll();
rootNode.Expand();
if (currentSelectedNode == null) return;
while ((currentSelectedNode != rootNode) && ( currentSelectedNode != null ))
{
currentSelectedNode.Expand();
currentSelectedNode = currentSelectedNode.Parent;
}
}
示例7: showTreeOK
protected void showTreeOK(TreeNode logini, DateTime aux_dtIni)
{
//Variaveis...
List<MPSfwk.Model.Audits> _lstOK;
aud = new MPSfwk.Model.Audits();
//Seta os descendentes...
TreeNode resOK = null;
TreeNode classes = null;
TreeNode servers = null;
//------------------------------------------------
//Chama a rotina para ver as OK...
aud.IDGeracao = aux_dtIni.ToString("yyyyMMdd");
_lstOK = SqlServer.AuditXML.lstAudits(aud, 3, ordBY[0]);
//
resOK = new TreeNode("OK: (" + _lstOK.Count + ")");
resOK.SelectAction = TreeNodeSelectAction.Expand;
resOK.Text = "<div style='color:#006600;font-size:Small;font-weight:bold;'>" + resOK.Text + "</div>";
resOK.ToolTip = "Abaixo estão as Classes e Servidores Auditados com sucesso!";
logini.ChildNodes.Add(resOK);
//
string aux_cls = "";
int contOK = 0;
foreach (MPSfwk.Model.Audits ax in _lstOK)
{
if (aux_cls != ax.IDClasse)
{
if (aux_cls != "")
{ classes.Text = classes.Text + " (" + contOK + ")"; }
classes = new TreeNode("Classe: (" + ax.IDClasse.Trim() + ")");
classes.SelectAction = TreeNodeSelectAction.Expand;
resOK.ChildNodes.Add(classes);
servers = new TreeNode("Servidor: (" + ax.IDServer.Trim() + ")");
servers.SelectAction = TreeNodeSelectAction.Expand;
classes.ChildNodes.Add(servers);
contOK = 1;
}
else
{
servers = new TreeNode("Servidor: (" + ax.IDServer.Trim() + ")");
servers.SelectAction = TreeNodeSelectAction.Expand;
classes.ChildNodes.Add(servers);
contOK++;
}
aux_cls = ax.IDClasse;
}
if (aux_cls != "")
{ classes.Text = classes.Text + " (" + contOK + ")"; }
if (servers != null)
servers.CollapseAll();
if (classes != null)
classes.CollapseAll();
resOK.CollapseAll();
//
//------------------------------------------------
}
示例8: showTreeFalhas
protected void showTreeFalhas()
{
//Variaveis...
List<MPSfwk.Model.Audits> _lstNOK;
aud = new MPSfwk.Model.Audits();
//Inicia o TreeView...
TreeView1.Nodes.Clear();
TreeView1.Visible = true;
TreeNode raiz = new TreeNode("_______________________________Conteudo________________________________");
raiz.SelectAction = TreeNodeSelectAction.Expand;
TreeView1.Nodes.Add(raiz);
//Seta os descendentes...
TreeNode logini = null;
TreeNode servers = null;
TreeNode resNOK = null;
//Seta Cabecalho do TreeView...
DateTime aux_dtIni = DateTime.Now;
dtSel3.Visible = true;
dtSel3.Text = String.Format("LOG das Gerações Auditadas para os Ativos (Ultima Semana): {0} e {1}", aux_dtIni.ToString("dd/MM/yyyy"), aux_dtIni.AddDays(-7).ToString("dd/MM/yyyy"));
//Seta os nos das Geracoes... Loop 7 ultimos dias...
for (int i = 1; i <= 8; i++)
{
logini = new TreeNode("Geração: (" + aux_dtIni.ToString("dd/MM/yyyy") + ")");
logini.SelectAction = TreeNodeSelectAction.Expand;
raiz.ChildNodes.Add(logini);
//------------------------------------------------
//Chama a rotina para ver as falhas...
aud.IDGeracao = aux_dtIni.ToString("yyyyMMdd");
_lstNOK = SqlServer.AuditXML.lstAudits(aud, 4, ordBY[0]);
//
resNOK = new TreeNode("FALHA: (" + _lstNOK.Count + ")");
resNOK.SelectAction = TreeNodeSelectAction.Expand;
resNOK.Text = "<div style='color:#FF3300;font-size:Small;font-weight:bold;'>" + resNOK.Text + "</div>";
resNOK.ToolTip = "Por gentileza, verifique os LOGs dos Agendamentos para identificar a falha!";
logini.ChildNodes.Add(resNOK);
//
foreach (MPSfwk.Model.Audits ax in _lstNOK)
{
servers = new TreeNode("Servidor: (" + ax.IDServer.Trim() + ")");
servers.SelectAction = TreeNodeSelectAction.Expand;
resNOK.ChildNodes.Add(servers);
}
resNOK.CollapseAll();
//
//------------------------------------------------
//Chama a rotina para ver as OK...
showTreeOK(logini, aux_dtIni);
aux_dtIni = DateTime.Now.AddDays(-i);
}
}
示例9: 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;
}
}