2010年2月24日星期三

asp.net Treeview SelectedNodeStyle无效果的原因

  The text of a node in the TreeView control can be in one of two modes:selection mode or navigation mode.When a node is in navigation mode, all selection events are disabled for that node. Clicking the node in navigation mode directs the user to the specified URL.

       You have used the NavigateUrl for all the nodes, so only OnSelectedNodeChanged is not getting fired.

        当一个节点是在导航模式下,所有的选择事件是停用的。点击节点的导航模式引导用户到指定的网址。您可以选择设定目标财产指定窗口或框架中显示链接的内容。因为选择事件被停用,所以导致选择节点后该节点的SelectedNodeStyle并没有产生效果。如果要产生效果,可以在OnSelectedNodeChanged 事件中设置。HoverNodeStyle是始终可以有效的。        


      The text of a node in the TreeView control can be in one of two modes: selection mode or navigation mode. By default, a node is in selection mode. To put a node into navigation mode, set the node's NavigateUrl property to a value other than an empty string (""). To put a node into selection mode, set the node's NavigateUrl property to an empty string.

      By default, clicking a node that is in selection mode posts the page back to the server and raises the SelectedNodeChanged event. You can optionally specify a different event to raise by setting the node's SelectAction property. For more information, see SelectAction. To determine which node was clicked in selection mode, use the SelectedNode property of the TreeView control.

      When a node is in navigation mode, all selection events are disabled for that node. Clicking the node in navigation mode directs the user to the specified URL. You can optionally set the Target property to specify the window or frame in which to display the linked content.
发表评论