On the client side, an array will be used to maintain a list of nodes that will be considered selected. In this example, a node is considered selected if its Tag property is equal to "Selected". The Tag property was chosen in this case because changes to the Tag property made on the client side will persist to the server. The default selected style is removed so that a consistent node style can be applied in the javascript. In this example, selected nodes will have their text color changed to blue. The code displayed below can be found in the samples in this article.
Step-By-Step Example
1. Place an UltraWebTree onto the web form.2. In the Page_Load event, add some nodes to the tree and set the SelectedNodeStyle color properties of the tree to Transparent.
if(!Page.IsPostBack)
{
for(int i = 0; i < 5; i++)
{
Infragistics.WebUI.UltraWebNavigator.Node topLevel =
new Infragistics.WebUI.UltraWebNavigator.Node();
topLevel.Text = "Root " + i.ToString();
for(int j = 0; j < 5; j++)
{
Infragistics.WebUI.UltraWebNavigator.Node subLevel =
new Infragistics.WebUI.UltraWebNavigator.Node();
subLevel.Text = "Child " + i.ToString() + " " + j.ToString();
topLevel.Nodes.Add(subLevel);
}
UltraWebTree1.Nodes.Add(topLevel);
}
//Since the javascript handles the SelectedNodeStyle look
//these can be set to Transparent
UltraWebTree1.SelectedNodeStyle.BackColor = Color.Transparent;
UltraWebTree1.SelectedNodeStyle.ForeColor = Color.Transparent;
}
No comments:
Post a Comment