I've tried several code snippets but nothing works well and I'm beginning to suspect I'm not calling the procedure properly. Here's my latest code:
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnNodeTextSearch_Click(object sender, EventArgs e)
{
FindByText();
}
protected void FindByText()
{
TreeNodeCollection nodes = tvOptions.Nodes;
foreach (TreeNode n in nodes)
{
// if the text properties match, color the item
if (n.Text.Contains(this.txtSearch.Text) == true)
{
n.Parent.Expanded = true;
lblResult.Text = n.Text;
}
else
{
n.Expand();
lblResult.Text = "Not Found";
}
}
}
}
Many thanks for your kind help.

New Topic/Question
Reply




MultiQuote


|