本文整理汇总了C#中RadTreeNode类的典型用法代码示例。如果您正苦于以下问题:C# RadTreeNode类的具体用法?C# RadTreeNode怎么用?C# RadTreeNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RadTreeNode类属于命名空间,在下文中一共展示了RadTreeNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadMenus
//加载菜单
/// <summary>
/// 加载菜单
/// </summary>
/// <param name="treeView"></param>
internal static void LoadMenus(RadTreeView treeView)
{
treeView.Nodes.Clear();
var lstData = ViewBll.QueryViewRight(new QueryCondition
{
UserId = GloableData.Instance.UserId
});
if (lstData == null || lstData.Count <= 0)
return;
//第一级菜单
var groupData = QueryMenuGroups(lstData);
if (groupData == null || groupData.Count <= 0)
return;
foreach (var group in groupData)
{
//第二级菜单
var groupNode = new RadTreeNode(group);
var funcData = QueryMenuFunctions(lstData, group);
if (funcData == null || funcData.Count <= 0)
continue;
foreach (var entity in funcData)
{
//第三级菜单 功能菜单
var funcNode = new RadTreeNode
{
Text = entity.FunctionName,
Tag = entity
};
groupNode.Nodes.Add(funcNode);
}
treeView.Nodes.Add(groupNode);
}
}
示例2: AddNode
private static bool AddNode(RadTreeNode parentNode, ContentItem parentItem, ContentItem currentItem, int level)
{
++level;
bool descendantIsCurrentNode = false;
bool isCurrentNode = (parentItem.ID == currentItem.ID);
foreach (N2.ContentItem childItem in GetChildren(parentItem))
{
if (childItem.GetType() != typeof(ImageGalleryItem)
|| (childItem.GetType() == typeof(ImageGalleryItem)
&& childItem.GetDetail<bool>("ShowOnNavigation", true)))
{
RadTreeNode childNode = new RadTreeNode();
bool b = AddNode(childNode, childItem, currentItem, level);
descendantIsCurrentNode = descendantIsCurrentNode || b;
parentNode.Nodes.Add(childNode);
}
}
SetNode(parentNode, parentItem, isCurrentNode, level, false, descendantIsCurrentNode);
return isCurrentNode || descendantIsCurrentNode;
}
示例3: SetNode
private static void SetNode(RadTreeNode treeNode, ContentItem contentItem, bool isCurrentNode, int level, bool isRootNode, bool descendantIsCurrentNode)
{
string result = string.Empty;
string divFormat = "<div class=\"{0}\"><div style=\"white-space:normal\">{1}</div></div>";
// set layout
if (level <= 1)
{
result += string.Format(divFormat, "nav_r_l", contentItem.Title);
}
else if (level <= 2)
{
result += string.Format(divFormat, "nav_c_l", contentItem.Title);
}
else if (level <= 3)
{
result += string.Format(divFormat, "nav_gc_l", contentItem.Title);
}
else
{
result += string.Format(divFormat, "nav_ggc_l", contentItem.Title);
}
treeNode.Text = result;
treeNode.NavigateUrl = contentItem.Url;
SetStyle(treeNode, contentItem, isCurrentNode, descendantIsCurrentNode, level);
}
示例4: RestoreTreeViewExpandedState
private void RestoreTreeViewExpandedState(RadTreeNodeCollection nodes, List<bool?> list)
{
foreach (RadTreeNode node in nodes)
{
if (RestoreTreeViewIndex >= list.Count) return;
node.Expanded = (bool)list[RestoreTreeViewIndex++];
if (node.Nodes.Count > 0)
{
RestoreTreeViewExpandedState(node.Nodes, list);
RadTreeNode _selectedNode = new RadTreeNode();
_selectedNode = (RadTreeNode)HttpContext.Current.Session["_selectedNode"];
foreach (RadTreeNode _node in node.Nodes)
{
if (_selectedNode != null)
{
string _nodeText = _node.Text;
string _selectedNodeText = _selectedNode.Text;
if (_node.Text == _selectedNode.Text)
_node.Selected = true;
}
}
}
}
}
示例5: AddNodeToTree
public void AddNodeToTree(RadTreeNode parentNode, DataTable _dtTree,string FeildValue, string FeildText, string FeildParent)
{
try
{
DataRow[] _Row = null;
int k = 0;
RadTreeNode currentNode = default(RadTreeNode);
_Row = _dtTree.Select(FeildParent + " = " + parentNode.Value.ToString() ,FeildValue + " ASC");
if (_Row.Length > 0)
{
for (k = 0; k <= _Row.Length - 1; k++)
{
//If _Row(k)("Ten_Hien_Thi").ToString <> "Phân quyền người dùng" Then
RadTreeNode Node = new RadTreeNode(_Row[k][FeildText].ToString(), _Row[k][FeildValue].ToString());
parentNode.Nodes.Add(Node);
currentNode = Node;
currentNode.Checked = false;
AddNodeToTree(currentNode, _dtTree, FeildValue, FeildText, FeildParent);
//End If
}
}
//nd _Row(k)("Ten_Hien_Thi").ToString <> "Danh mục tuyến thu" And _Row(k)("Ten_Hien_Thi").ToString <> "Kiểm tra và chốt số liệu" And _Row(k)("Ten_Hien_Thi").ToString <> "Danh mục cụm địa chỉ"
}
catch (Exception ex)
{
}
}
示例6: SetStyle
private static void SetStyle(RadTreeNode treeNode, ContentItem contentItem, bool isCurrentNode, bool descendantIsCurrentNode, int level)
{
if (isCurrentNode || descendantIsCurrentNode)
{
if (level <= 1)
{
treeNode.CssClass = "nav_r_sel";
treeNode.HoveredCssClass = "nav_r_sel_ho";
treeNode.SelectedCssClass = "nav_r_sel_ho";
}
else if (level <= 2)
{
treeNode.CssClass = "nav_c_sel";
treeNode.HoveredCssClass = "nav_c_sel_ho";
treeNode.SelectedCssClass = "nav_c_sel_ho";
}
else if (level <= 3)
{
treeNode.CssClass = "nav_gc_sel";
treeNode.HoveredCssClass = "nav_gc_sel_ho";
treeNode.SelectedCssClass = "nav_gc_sel_ho";
}
else
{
treeNode.CssClass = "nav_ggc_sel";
treeNode.HoveredCssClass = "nav_ggc_sel_ho";
treeNode.SelectedCssClass = "nav_ggc_sel_ho";
}
treeNode.Expanded = true;
}
else
{
if (level <= 1)
{
treeNode.CssClass = "nav_r";
treeNode.HoveredCssClass = "nav_r_ho";
treeNode.SelectedCssClass = "nav_r_ho";
}
else if (level <= 2)
{
treeNode.CssClass = "nav_c";
treeNode.HoveredCssClass = "nav_c_ho";
treeNode.SelectedCssClass = "nav_c_ho";
}
else if (level <= 3)
{
treeNode.CssClass = "nav_gc";
treeNode.HoveredCssClass = "nav_gc_ho";
treeNode.SelectedCssClass = "nav_gc_ho";
}
else
{
treeNode.CssClass = "nav_ggc";
treeNode.HoveredCssClass = "nav_ggc_ho";
treeNode.SelectedCssClass = "nav_ggc_ho";
}
}
}
示例7: Build
public static RadTreeNode Build(File sol)
{
var n = new RadTreeNode(sol.Name);
n.Tag = sol;
n.Image = Icons[sol.ID];
return n;
}
示例8: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
tbl_CommandsTableAdapter cm = new tbl_CommandsTableAdapter();
string ModuleName = "";
if (Request.QueryString["pid"] != null)
{
ModuleName = Request.QueryString["pid"].ToString();
ModuleName = new tbl_modulesTableAdapter().GetFormNameFromID(Convert.ToInt32(ModuleName));
string username = "guest";
string pass = "pRS+UaJqCcwAcBEcdkJ6UmEQwvtkSm4GGero4+PfWIUrC7XpxXsgxi9xr0ha6paZ";
if (Request.Cookies["username"] != null && Request.Cookies["password"] != null)
{
username = Request.Cookies["username"].Value.ToString();
pass = Request.Cookies["password"].Value.ToString();
}
if (ModuleName != "")
{
Control cnt = LoadControl(new main_class().Load_Control(ModuleName, username, pass));
ph.Controls.Add(cnt);
}
}
if (!IsPostBack)
{
trv_units.Nodes.Clear();
foreach (DataRow dr in new tbl_units_groupsTableAdapter().GetDataBy(Convert.ToInt32(Session["OwnerID"].ToString())))
{
RadTreeNode rtn = new RadTreeNode(dr["cg_name"].ToString());
foreach (DataRow dr1 in new tbl_unitsTableAdapter().GetDataByGroupID(
Convert.ToInt32(Session["OwnerID"].ToString()),
Convert.ToInt32(dr["cg_id"].ToString())))
{
RadTreeNode rtn1 = new RadTreeNode(dr1["c_unit_id"].ToString());
if (dr1["c_family"] != null)
{
rtn1.ToolTip = dr1["c_family"].ToString();
}
rtn1.Text = dr1["c_unit_id"].ToString();
//rtn1.NavigateUrl = "javascript:ShowLastPostStaticWin(" + dr1["c_unit_id"].ToString() + ")";
rtn1.DataBind();
rtn1.ForeColor = Color.Black;
rtn.Nodes.Add(rtn1);
}
trv_units.Nodes.Add(rtn);
}
}
}
示例9: ListNodes
private static void ListNodes(RadTreeNode node)
{
var buff = new StringBuilder();
for (var i = 0; i < node.Level; i++)
buff.Append(",");
foreach (var subnode in node.Nodes)
{
sb.AppendLine(buff.ToString()+"," + subnode.Text.Replace("<=", ","));
ListNodes(subnode);
}
}
示例10: Initialize
public void Initialize()
{
var categories = _categoryService.GetAll();
var nodes = RecursivelySetTreeNode(categories, null);
var rootNode = new RadTreeNode("Root", "-1");
rootNode.Nodes.AddRange(nodes);
rootNode.ExpandChildNodes();
_categoryListingView.Categories.Nodes.Add(rootNode);
_categoryListingView.Categories.ExpandAllNodes();
_categoryListingView.Categories.DataBind();
}
示例11: CreateTree
public RadTreeNode CreateTree(RadTreeNode node, Item[] item)
{
foreach (var i in item)
{
var n = new RadTreeNode(i.Name);
if (i.Children != null && i.Children.Count() > 0)
{
CreateTree(n, i.Children.ToArray());
}
node.Nodes.Add(n);
}
return node;
}
示例12: LoadFolder
private void LoadFolder(DirectoryInfo directory, RadTreeNode treeNode)
{
foreach (DirectoryInfo dirs in directory.GetDirectories())
{
var node = new RadTreeNode
{
Text = dirs.Name,
Value = string.Format("{0}\\{1}", treeNode.Value, dirs.Name)
};
treeNode.Nodes.Add(node);
if (dirs.GetDirectories().Any())
LoadFolder(dirs, node);
}
}
示例13: GeneratingTheCode
private static string GeneratingTheCode(RadTreeNode node, int level, string generatedCode)
{
string currentCode = "";
currentCode += ShiftNTabsInTheConsole(level);
currentCode += "try {" + Environment.NewLine;
currentCode += ShiftNTabsInTheConsole(level+1);
currentCode += "if (" + semanticsInString.ToString() + "[" + level.ToString() + "].Key == \"" + node.Text.ToString() + "\")";
currentCode += "{";
if ((node.Tag as GrammarTreeViewTag).Optional)
{
currentCode += " //optional element";
}
currentCode += Environment.NewLine;
if (node.Tag != null)
{
if ((node.Tag as GrammarTreeViewTag).IsDictation)
{
currentCode += ShiftNTabsInTheConsole(level + 2);
string dictationFor = node.Text.Replace(" ", "");
currentCode += "string dictationFor" + dictationFor + " = "
+ semanticsInString + "[" + level.ToString() + "].Value;" + Environment.NewLine;
}
else
{
currentCode += Environment.NewLine;
}
}
int iteration = 0;
foreach (var childNode in node.Nodes)
{
iteration++;
currentCode += GeneratingTheCode(childNode, level + 1, generatedCode);
}
currentCode += ShiftNTabsInTheConsole(level+1);
currentCode += "}" + Environment.NewLine;
currentCode += ShiftNTabsInTheConsole(level);
currentCode += "}" + Environment.NewLine;
currentCode += ShiftNTabsInTheConsole(level);
currentCode += "catch (Exception e) { }" + Environment.NewLine + Environment.NewLine;
return currentCode;
}
示例14: IsSelectable
private bool IsSelectable(TreeSearchInfo info, RadTreeNode node)
{
//if (!info.AllowSelectFirstNode && node.ParentNode == null)
//{
// base.RadAlert("En Üst Düğüm Seçilemez");
// return false;
//}
if (info.OnlySelectLastNode && node.Nodes.Count != 0)
{
base.RadAlert("Yalnızca En Alt Kayıdı Seçebilirsiniz");
return false;
}
return true;
}
示例15: FindNodeByValue
private RadTreeNode FindNodeByValue(RadTreeNode parentNode, string value)
{
if (String.Equals(parentNode.Value, value, StringComparison.OrdinalIgnoreCase)) return parentNode;
if (parentNode.Nodes.Count != 0)
{
foreach (RadTreeNode child in parentNode.Nodes)
{
return this.FindNodeByValue(child, value);
}
}
return null;
}