FineUI 官方论坛
标题:
怎么tree动态设置样式
[打印本页]
作者:
963272311
时间:
2016-4-29 13:30
标题:
怎么tree动态设置样式
比如我在搜索输入框中输入字符串,在左侧的tree下把搜索到的节点高亮显示。我现在可以搜索到节点,求怎么将节点动态高亮显示
文件搜索控件
<f:TwinTriggerBox ID="reserch" runat="server" ShowLabel="false" OnTrigger1Click="on_reserch1_Click"
OnTrigger2Click="on_reserck2_Click" ShowTrigger1="false" EmptyText="搜索文件/文件夹"
Trigger2Icon="Search" Trigger1Icon="Clear"></f:TwinTriggerBox>
搜索控件点击事件
protected void on_reserch1_Click(object sender, EventArgs e)
{
//执行取消操作
Alert.Show("取消");
reserch.Text = "";
reserch.ShowTrigger1 = false;
}
protected void on_reserck2_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(reserch.Text))
{
//执行搜索操作
reserch.ShowTrigger1 = true;
reserchFromTree(TreeView2.SelectedNode, reserch.Text);
Alert.Show("搜索完毕");
}
else
{
Alert.Show("请输入搜索关键词");
}
}
protected void reserchFromTree(FineUI.TreeNode tree, string serch)
{
if (tree.Leaf)
{
if (tree.Text.Contains(serch))
{
//tree.CssClass = FineUI.StyleUtil.GetMarginPaddingStyle("important");
tree.Text += "搜索到文件";
}
return;
}
if (tree.Text.Contains(serch))
{
//tree.CssClass = FineUI.StyleUtil.GetMarginPaddingStyle("important");
tree.Text += "搜索到文件夹";
}
foreach (FineUI.TreeNode no in tree.Nodes)
{
reserchFromTree(no, serch);
}
}
感觉应该是tree.cssclass属性,但是不知道属性值
欢迎光临 FineUI 官方论坛 (https://fineui.com/bbs/)
Powered by Discuz! X3.4