回发后将焦点设置为treeview节点 [英] Set focus to treeview node after postback

查看:93
本文介绍了回发后将焦点设置为treeview节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的asp.net页面上有一个treeview控件来显示信息,treeview的每个节点都有一个唯一的值,我想在treeview控件中搜索一个单词,突出显示该单词并转到第一个单词的出现,即将焦点设置到此节点。这通常会涉及向下滚动页面。



我可以通过树视图控件进行搜索并突出显示该单词,但我无法将焦点设置为第一个节点。



我一直试图通过锚标签移动到每个节点,但是无法让它工作,有关如何克服我的问题的任何建议吗?


谢谢

解决方案

尝试在文档中链接如下:



如果你想创建一个名为tree-node-name的锚点,只需将这一行添加到你想要锚点的位置:



 <   a     name   =  tree-node-name > 您的节点<   / a  >  





执行此操作后,您可以使用普通& lt; a href标记创建指向锚点的链接,如下所示:

单击

 <   a     href   = #tree-node-name    /  >  





您可以通过将#name附加到您的基页网址链接来访问此链接

 www.your-domain-com / your-page的.aspx#树节点名称


I have a treeview control on my asp.net page to display information, each node of the treeview has a unique value, I want to do a search for a word in the treeview control, highlight the word and go to the first occurrence of the word, ie set focus to this node. This will normally involve scrolling down the page.

I can do the search through the treeview control and highlight the word but I cant get the focus to be set to this first node.

I have been trying to move to each node through an anchor tag but cant get it to work, any suggestions on how to overcome my problem?

Thanks

解决方案

Try linking within the document like this:

If you want to create an anchor called tree-node-name, you simply add this line where you want the anchor to be:

<a name="tree-node-name">Your node</a>



After doing this, you can make a link pointing to the anchor using the normal&lt;a href tag, like this:
Click

<a href="#tree-node-name" />



You can access this via link by appending #name to your base page url

www.your-domain-com/your-page.aspx#tree-node-name


这篇关于回发后将焦点设置为treeview节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆