To add a client event for the TreeView

Source: Internet
Author: User
When the treeview| client uses the TreeView control, the server will be burdened by the need to return to the server for the information needed to obtain the selection node.

If only to pick up the selection of the node information, in fact, there is no need to return to the server, the client can also.

. CS File:

TreeNode nodef = new TreeNode ();

Nodef.id = Drks[0]. ToString () + "\ onclick=\" Javascript:node_click (' +drks[0]. ToString () + "');"; The key is in the red section of the code.

Nodef.text = drks[1]. ToString ();

T_TJXMWH.NODES.ADD (NODEF);

The above code is actually adding the onclick event for each node, passing the required information as a parameter to the OnClick event handler function.

Client script:
<script language=javascript>
<!--
function Node_click (text)
{
Window.parent.frm_right.location.replace ("Atjxmwh_right.aspx?") Parameters= "+text);
}
-->
</SCRIPT>

Note: This article elaborated the method, perhaps some kind of alternative, this is my helpless lift. If there is a better way, please tell me, thank you.
e-mail:czhenq@yahoo.com.cn
qq:3671909




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.