TreeNode Конструкторы
Определение
Важно!
Некоторые сведения относятся к предварительной версии продукта, в которую до выпуска могут быть внесены существенные изменения. Майкрософт не предоставляет никаких гарантий, явных или подразумеваемых, относительно приведенных здесь сведений.
Инициализирует новый экземпляр класса TreeNode.
Перегрузки
| TreeNode() |
Инициализирует новый экземпляр класса TreeNode без текста или значения. |
| TreeNode(String) |
Инициализирует новый экземпляр класса TreeNode с помощью указанного текста. |
| TreeNode(String, String) |
Инициализирует новый экземпляр класса TreeNode, используя указанные текст и значение. |
| TreeNode(TreeView, Boolean) |
Инициализирует новый экземпляр класса TreeNode с помощью указанного владельца. |
| TreeNode(String, String, String) |
Инициализирует новый экземпляр класса TreeNode, используя указанные текст, значение и URL-адрес изображения. |
| TreeNode(String, String, String, String, String) |
Инициализирует новый экземпляр класса TreeNode, используя указанные текст, значение, URL-адрес изображения, URL-адрес навигации и цель. |
TreeNode()
Инициализирует новый экземпляр класса TreeNode без текста или значения.
public:
TreeNode();
public TreeNode ();
Public Sub New ()
Примеры
В следующем примере кода показано, как использовать этот конструктор для динамического добавления узла в TreeView элемент управления.
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
void Page_Init(Object sender, EventArgs e)
{
if(!IsPostBack)
{
// Add the first tree to the TreeView control.
CreateTree("Section 1");
// Add the second tree to the TreeView control.
CreateTree("Section 2");
}
}
void CreateTree(String NodeText)
{
// Create the root node using the default constructor.
TreeNode root = new TreeNode();
root.Text = NodeText;
// Use the ChildNodes property of the root TreeNode to add child nodes.
// Create the node using the constructor that takes the text parameter.
root.ChildNodes.Add(new TreeNode("Topic 1"));
// Create the node using the constructor that takes the text and value parameters.
root.ChildNodes.Add(new TreeNode("Topic 2", "Value 2"));
// Create the node using the constructor that takes the text, value,
// and imageUrl parameters.
root.ChildNodes.Add(new TreeNode("Topic 3", "Value 3", "Image1.jpg"));
// Create the node using the constructor that takes the text, value,
// imageUrl, navigateUrl, and target parameters.
root.ChildNodes.Add(new TreeNode("Topic 4", "Value 4", "Image1.jpg", "http://www.microsoft.com", "_blank"));
// Add the root node to the Nodes collection of the TreeView control.
DynamicTreeView.Nodes.Add(root);
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>TreeNode Constructor Example</title>
</head>
<body>
<form id="form1" runat="server">
<h3>TreeNode Constructor Example</h3>
<asp:TreeView id="DynamicTreeView"
EnableClientScript="false"
ExpandDepth="2"
runat="server">
</asp:TreeView>
</form>
</body>
</html>
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Sub Page_Init(ByVal sender As Object, ByVal e As EventArgs)
If Not IsPostBack Then
' Add the first tree to the TreeView control.
CreateTree("Section 1")
' Add the second tree to the TreeView control.
CreateTree("Section 2")
End If
End Sub
Sub CreateTree(ByVal NodeText As String)
' Create the root node using the default constructor.
Dim root As TreeNode = New TreeNode
root.Text = NodeText
' Use the ChildNodes property of the root TreeNode to add child nodes.
' Create the node using the constructor that takes the text parameter.
root.ChildNodes.Add(New TreeNode("Topic 1"))
' Create the node using the constructor that takes the text and value parameters.
root.ChildNodes.Add(New TreeNode("Topic 2", "Value 2"))
' Create the node using the constructor that takes the text, value,
' and imageUrl parameters.
root.ChildNodes.Add(New TreeNode("Topic 3", "Value 3", "Image1.jpg"))
' Create the node using the constructor that takes the text, value,
' imageUrl, navigateUrl, and target parameters.
root.ChildNodes.Add(New TreeNode("Topic 4", "Value 4", "Image1.jpg", "http://www.microsoft.com", "_blank"))
' Add the root node to the Nodes collection of the TreeView control.
DynamicTreeView.Nodes.Add(root)
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>TreeNode Constructor Example</title>
</head>
<body>
<form id="form1" runat="server">
<h3>TreeNode Constructor Example</h3>
<asp:TreeView id="DynamicTreeView"
EnableClientScript="false"
ExpandDepth="2"
runat="server">
</asp:TreeView>
</form>
</body>
</html>
Комментарии
Используйте этот конструктор для инициализации нового экземпляра класса с помощью значений TreeNode по умолчанию.
Примечание
При использовании этого конструктора все свойства в объекте TreeNode устанавливаются в значения по умолчанию. При необходимости задайте свойства после создания объекта.
См. также раздел
Применяется к
TreeNode(String)
Инициализирует новый экземпляр класса TreeNode с помощью указанного текста.
public:
TreeNode(System::String ^ text);
public TreeNode (string text);
new System.Web.UI.WebControls.TreeNode : string -> System.Web.UI.WebControls.TreeNode
Public Sub New (text As String)
Параметры
Примеры
В следующем примере кода показано, как использовать этот конструктор для динамического добавления узла в TreeView элемент управления.
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
void Page_Init(Object sender, EventArgs e)
{
if(!IsPostBack)
{
// Add the first tree to the TreeView control.
CreateTree("Section 1");
// Add the second tree to the TreeView control.
CreateTree("Section 2");
}
}
void CreateTree(String NodeText)
{
// Create the root node using the default constructor.
TreeNode root = new TreeNode();
root.Text = NodeText;
// Use the ChildNodes property of the root TreeNode to add child nodes.
// Create the node using the constructor that takes the text parameter.
root.ChildNodes.Add(new TreeNode("Topic 1"));
// Create the node using the constructor that takes the text and value parameters.
root.ChildNodes.Add(new TreeNode("Topic 2", "Value 2"));
// Create the node using the constructor that takes the text, value,
// and imageUrl parameters.
root.ChildNodes.Add(new TreeNode("Topic 3", "Value 3", "Image1.jpg"));
// Create the node using the constructor that takes the text, value,
// imageUrl, navigateUrl, and target parameters.
root.ChildNodes.Add(new TreeNode("Topic 4", "Value 4", "Image1.jpg", "http://www.microsoft.com", "_blank"));
// Add the root node to the Nodes collection of the TreeView control.
DynamicTreeView.Nodes.Add(root);
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>TreeNode Constructor Example</title>
</head>
<body>
<form id="form1" runat="server">
<h3>TreeNode Constructor Example</h3>
<asp:TreeView id="DynamicTreeView"
EnableClientScript="false"
ExpandDepth="2"
runat="server">
</asp:TreeView>
</form>
</body>
</html>
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Sub Page_Init(ByVal sender As Object, ByVal e As EventArgs)
If Not IsPostBack Then
' Add the first tree to the TreeView control.
CreateTree("Section 1")
' Add the second tree to the TreeView control.
CreateTree("Section 2")
End If
End Sub
Sub CreateTree(ByVal NodeText As String)
' Create the root node using the default constructor.
Dim root As TreeNode = New TreeNode
root.Text = NodeText
' Use the ChildNodes property of the root TreeNode to add child nodes.
' Create the node using the constructor that takes the text parameter.
root.ChildNodes.Add(New TreeNode("Topic 1"))
' Create the node using the constructor that takes the text and value parameters.
root.ChildNodes.Add(New TreeNode("Topic 2", "Value 2"))
' Create the node using the constructor that takes the text, value,
' and imageUrl parameters.
root.ChildNodes.Add(New TreeNode("Topic 3", "Value 3", "Image1.jpg"))
' Create the node using the constructor that takes the text, value,
' imageUrl, navigateUrl, and target parameters.
root.ChildNodes.Add(New TreeNode("Topic 4", "Value 4", "Image1.jpg", "http://www.microsoft.com", "_blank"))
' Add the root node to the Nodes collection of the TreeView control.
DynamicTreeView.Nodes.Add(root)
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>TreeNode Constructor Example</title>
</head>
<body>
<form id="form1" runat="server">
<h3>TreeNode Constructor Example</h3>
<asp:TreeView id="DynamicTreeView"
EnableClientScript="false"
ExpandDepth="2"
runat="server">
</asp:TreeView>
</form>
</body>
</html>
Комментарии
Используйте этот конструктор для инициализации нового экземпляра TreeNode класса с помощью текста, указанного параметром text .
В следующей таблице показано начальное значение свойства для экземпляра TreeNode.
| Свойство. | Начальное значение |
|---|---|
| Text | Значение параметра text. |
См. также раздел
Применяется к
TreeNode(String, String)
Инициализирует новый экземпляр класса TreeNode, используя указанные текст и значение.
public:
TreeNode(System::String ^ text, System::String ^ value);
public TreeNode (string text, string value);
new System.Web.UI.WebControls.TreeNode : string * string -> System.Web.UI.WebControls.TreeNode
Public Sub New (text As String, value As String)
Параметры
- value
- String
Дополнительные данные об узле, как данные, используемые для обработки событий обратной передачи.
Примеры
В следующем примере кода показано, как использовать этот конструктор для динамического добавления узла в TreeView элемент управления.
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
void Page_Init(Object sender, EventArgs e)
{
if(!IsPostBack)
{
// Add the first tree to the TreeView control.
CreateTree("Section 1");
// Add the second tree to the TreeView control.
CreateTree("Section 2");
}
}
void CreateTree(String NodeText)
{
// Create the root node using the default constructor.
TreeNode root = new TreeNode();
root.Text = NodeText;
// Use the ChildNodes property of the root TreeNode to add child nodes.
// Create the node using the constructor that takes the text parameter.
root.ChildNodes.Add(new TreeNode("Topic 1"));
// Create the node using the constructor that takes the text and value parameters.
root.ChildNodes.Add(new TreeNode("Topic 2", "Value 2"));
// Create the node using the constructor that takes the text, value,
// and imageUrl parameters.
root.ChildNodes.Add(new TreeNode("Topic 3", "Value 3", "Image1.jpg"));
// Create the node using the constructor that takes the text, value,
// imageUrl, navigateUrl, and target parameters.
root.ChildNodes.Add(new TreeNode("Topic 4", "Value 4", "Image1.jpg", "http://www.microsoft.com", "_blank"));
// Add the root node to the Nodes collection of the TreeView control.
DynamicTreeView.Nodes.Add(root);
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>TreeNode Constructor Example</title>
</head>
<body>
<form id="form1" runat="server">
<h3>TreeNode Constructor Example</h3>
<asp:TreeView id="DynamicTreeView"
EnableClientScript="false"
ExpandDepth="2"
runat="server">
</asp:TreeView>
</form>
</body>
</html>
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Sub Page_Init(ByVal sender As Object, ByVal e As EventArgs)
If Not IsPostBack Then
' Add the first tree to the TreeView control.
CreateTree("Section 1")
' Add the second tree to the TreeView control.
CreateTree("Section 2")
End If
End Sub
Sub CreateTree(ByVal NodeText As String)
' Create the root node using the default constructor.
Dim root As TreeNode = New TreeNode
root.Text = NodeText
' Use the ChildNodes property of the root TreeNode to add child nodes.
' Create the node using the constructor that takes the text parameter.
root.ChildNodes.Add(New TreeNode("Topic 1"))
' Create the node using the constructor that takes the text and value parameters.
root.ChildNodes.Add(New TreeNode("Topic 2", "Value 2"))
' Create the node using the constructor that takes the text, value,
' and imageUrl parameters.
root.ChildNodes.Add(New TreeNode("Topic 3", "Value 3", "Image1.jpg"))
' Create the node using the constructor that takes the text, value,
' imageUrl, navigateUrl, and target parameters.
root.ChildNodes.Add(New TreeNode("Topic 4", "Value 4", "Image1.jpg", "http://www.microsoft.com", "_blank"))
' Add the root node to the Nodes collection of the TreeView control.
DynamicTreeView.Nodes.Add(root)
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>TreeNode Constructor Example</title>
</head>
<body>
<form id="form1" runat="server">
<h3>TreeNode Constructor Example</h3>
<asp:TreeView id="DynamicTreeView"
EnableClientScript="false"
ExpandDepth="2"
runat="server">
</asp:TreeView>
</form>
</body>
</html>
Комментарии
Используйте этот конструктор для инициализации нового экземпляра класса с помощью текста и значения, указанного TreeNode text параметрами и соответствующими value параметрами.
В следующей таблице показаны начальные значения свойств для экземпляра TreeNode.
| Свойство | Начальное значение |
|---|---|
| Text | Значение параметра text. |
| Value | Значение параметра value. |
См. также раздел
Применяется к
TreeNode(TreeView, Boolean)
Инициализирует новый экземпляр класса TreeNode с помощью указанного владельца.
protected public:
TreeNode(System::Web::UI::WebControls::TreeView ^ owner, bool isRoot);
protected internal TreeNode (System.Web.UI.WebControls.TreeView owner, bool isRoot);
new System.Web.UI.WebControls.TreeNode : System.Web.UI.WebControls.TreeView * bool -> System.Web.UI.WebControls.TreeNode
Protected Friend Sub New (owner As TreeView, isRoot As Boolean)
Параметры
См. также раздел
Применяется к
TreeNode(String, String, String)
Инициализирует новый экземпляр класса TreeNode, используя указанные текст, значение и URL-адрес изображения.
public:
TreeNode(System::String ^ text, System::String ^ value, System::String ^ imageUrl);
public TreeNode (string text, string value, string imageUrl);
new System.Web.UI.WebControls.TreeNode : string * string * string -> System.Web.UI.WebControls.TreeNode
Public Sub New (text As String, value As String, imageUrl As String)
Параметры
- value
- String
Дополнительные данные об узле, как данные, используемые для обработки событий обратной передачи.
- imageUrl
- String
URL-адрес изображения для отображения рядом с текстом узла.
Примеры
В следующем примере кода показано, как использовать этот конструктор для динамического добавления узла в TreeView элемент управления.
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
void Page_Init(Object sender, EventArgs e)
{
if(!IsPostBack)
{
// Add the first tree to the TreeView control.
CreateTree("Section 1");
// Add the second tree to the TreeView control.
CreateTree("Section 2");
}
}
void CreateTree(String NodeText)
{
// Create the root node using the default constructor.
TreeNode root = new TreeNode();
root.Text = NodeText;
// Use the ChildNodes property of the root TreeNode to add child nodes.
// Create the node using the constructor that takes the text parameter.
root.ChildNodes.Add(new TreeNode("Topic 1"));
// Create the node using the constructor that takes the text and value parameters.
root.ChildNodes.Add(new TreeNode("Topic 2", "Value 2"));
// Create the node using the constructor that takes the text, value,
// and imageUrl parameters.
root.ChildNodes.Add(new TreeNode("Topic 3", "Value 3", "Image1.jpg"));
// Create the node using the constructor that takes the text, value,
// imageUrl, navigateUrl, and target parameters.
root.ChildNodes.Add(new TreeNode("Topic 4", "Value 4", "Image1.jpg", "http://www.microsoft.com", "_blank"));
// Add the root node to the Nodes collection of the TreeView control.
DynamicTreeView.Nodes.Add(root);
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>TreeNode Constructor Example</title>
</head>
<body>
<form id="form1" runat="server">
<h3>TreeNode Constructor Example</h3>
<asp:TreeView id="DynamicTreeView"
EnableClientScript="false"
ExpandDepth="2"
runat="server">
</asp:TreeView>
</form>
</body>
</html>
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Sub Page_Init(ByVal sender As Object, ByVal e As EventArgs)
If Not IsPostBack Then
' Add the first tree to the TreeView control.
CreateTree("Section 1")
' Add the second tree to the TreeView control.
CreateTree("Section 2")
End If
End Sub
Sub CreateTree(ByVal NodeText As String)
' Create the root node using the default constructor.
Dim root As TreeNode = New TreeNode
root.Text = NodeText
' Use the ChildNodes property of the root TreeNode to add child nodes.
' Create the node using the constructor that takes the text parameter.
root.ChildNodes.Add(New TreeNode("Topic 1"))
' Create the node using the constructor that takes the text and value parameters.
root.ChildNodes.Add(New TreeNode("Topic 2", "Value 2"))
' Create the node using the constructor that takes the text, value,
' and imageUrl parameters.
root.ChildNodes.Add(New TreeNode("Topic 3", "Value 3", "Image1.jpg"))
' Create the node using the constructor that takes the text, value,
' imageUrl, navigateUrl, and target parameters.
root.ChildNodes.Add(New TreeNode("Topic 4", "Value 4", "Image1.jpg", "http://www.microsoft.com", "_blank"))
' Add the root node to the Nodes collection of the TreeView control.
DynamicTreeView.Nodes.Add(root)
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>TreeNode Constructor Example</title>
</head>
<body>
<form id="form1" runat="server">
<h3>TreeNode Constructor Example</h3>
<asp:TreeView id="DynamicTreeView"
EnableClientScript="false"
ExpandDepth="2"
runat="server">
</asp:TreeView>
</form>
</body>
</html>
Комментарии
Используйте этот конструктор для инициализации нового экземпляра TreeNode класса, используя текст, значение и URL-адрес изображения, указанные параметром textи value``imageUrl параметрами соответственно.
В следующей таблице показаны начальные значения свойств для экземпляра TreeNode.
| Свойство | Начальное значение |
|---|---|
| Text | Значение параметра text. |
| Value | Значение параметра value. |
| ImageUrl | Значение параметра imageUrl. |
См. также раздел
Применяется к
TreeNode(String, String, String, String, String)
Инициализирует новый экземпляр класса TreeNode, используя указанные текст, значение, URL-адрес изображения, URL-адрес навигации и цель.
public:
TreeNode(System::String ^ text, System::String ^ value, System::String ^ imageUrl, System::String ^ navigateUrl, System::String ^ target);
public TreeNode (string text, string value, string imageUrl, string navigateUrl, string target);
new System.Web.UI.WebControls.TreeNode : string * string * string * string * string -> System.Web.UI.WebControls.TreeNode
Public Sub New (text As String, value As String, imageUrl As String, navigateUrl As String, target As String)
Параметры
- value
- String
Дополнительные данные об узле, как данные, используемые для обработки событий обратной передачи.
- imageUrl
- String
URL-адрес изображения для отображения рядом с текстом узла.
- navigateUrl
- String
URL-адрес для перемещения при щелчке по узлу.
- target
- String
Целевое окно или фрейм, для отображения содержимого веб-страницы, на которую осуществляется переход при щелчке по узлу.
Примеры
В следующем примере кода показано, как использовать этот конструктор для динамического добавления узла в TreeView элемент управления.
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
void Page_Init(Object sender, EventArgs e)
{
if(!IsPostBack)
{
// Add the first tree to the TreeView control.
CreateTree("Section 1");
// Add the second tree to the TreeView control.
CreateTree("Section 2");
}
}
void CreateTree(String NodeText)
{
// Create the root node using the default constructor.
TreeNode root = new TreeNode();
root.Text = NodeText;
// Use the ChildNodes property of the root TreeNode to add child nodes.
// Create the node using the constructor that takes the text parameter.
root.ChildNodes.Add(new TreeNode("Topic 1"));
// Create the node using the constructor that takes the text and value parameters.
root.ChildNodes.Add(new TreeNode("Topic 2", "Value 2"));
// Create the node using the constructor that takes the text, value,
// and imageUrl parameters.
root.ChildNodes.Add(new TreeNode("Topic 3", "Value 3", "Image1.jpg"));
// Create the node using the constructor that takes the text, value,
// imageUrl, navigateUrl, and target parameters.
root.ChildNodes.Add(new TreeNode("Topic 4", "Value 4", "Image1.jpg", "http://www.microsoft.com", "_blank"));
// Add the root node to the Nodes collection of the TreeView control.
DynamicTreeView.Nodes.Add(root);
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>TreeNode Constructor Example</title>
</head>
<body>
<form id="form1" runat="server">
<h3>TreeNode Constructor Example</h3>
<asp:TreeView id="DynamicTreeView"
EnableClientScript="false"
ExpandDepth="2"
runat="server">
</asp:TreeView>
</form>
</body>
</html>
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Sub Page_Init(ByVal sender As Object, ByVal e As EventArgs)
If Not IsPostBack Then
' Add the first tree to the TreeView control.
CreateTree("Section 1")
' Add the second tree to the TreeView control.
CreateTree("Section 2")
End If
End Sub
Sub CreateTree(ByVal NodeText As String)
' Create the root node using the default constructor.
Dim root As TreeNode = New TreeNode
root.Text = NodeText
' Use the ChildNodes property of the root TreeNode to add child nodes.
' Create the node using the constructor that takes the text parameter.
root.ChildNodes.Add(New TreeNode("Topic 1"))
' Create the node using the constructor that takes the text and value parameters.
root.ChildNodes.Add(New TreeNode("Topic 2", "Value 2"))
' Create the node using the constructor that takes the text, value,
' and imageUrl parameters.
root.ChildNodes.Add(New TreeNode("Topic 3", "Value 3", "Image1.jpg"))
' Create the node using the constructor that takes the text, value,
' imageUrl, navigateUrl, and target parameters.
root.ChildNodes.Add(New TreeNode("Topic 4", "Value 4", "Image1.jpg", "http://www.microsoft.com", "_blank"))
' Add the root node to the Nodes collection of the TreeView control.
DynamicTreeView.Nodes.Add(root)
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>TreeNode Constructor Example</title>
</head>
<body>
<form id="form1" runat="server">
<h3>TreeNode Constructor Example</h3>
<asp:TreeView id="DynamicTreeView"
EnableClientScript="false"
ExpandDepth="2"
runat="server">
</asp:TreeView>
</form>
</body>
</html>
Комментарии
Используйте этот конструктор для инициализации нового экземпляра TreeNode класса, используя текстовые, значения, URL-адреса изображений и навигации, а также целевой объект отображения, заданный textпараметрами , navigateUrl``value``imageUrlи target параметрами соответственно.
В следующей таблице показаны начальные значения свойств для экземпляра TreeNode.
| Свойство | Начальное значение |
|---|---|
| Text | Значение параметра text. |
| Value | Значение параметра value. |
| ImageUrl | Значение параметра imageUrl. |
| NavigateUrl | Значение параметра navigateUrl. |
| Target | Значение параметра target. |