In Asp.net 2.0, the selectedvalue of the Treeview control cannot be obtained.

Source: Internet
Author: User
These days CodeIn some cases, the selectedvalue of the Treeview control is obtained in the background code of the page, and the obtained value is always null, however, the data source control that is directly bound to the selectedvalue of the Treeview control can work normally.
Cause:
The Treeview control has a value only when its selectedvalue is changed and is returned to the server. In subsequent refreshes, The selectedvalue of the Treeview control does not have a value.
To solve this problem, I used to add a hidden control to the page. When the selectedvalue OF THE Treeview control changes, it is uploaded back to the server, that is, in the corresponding function of the onadaptedselectednodechanged event of the Treeview control, the selectedvalue of the Treeview control is written to the hidden control. In the future, the selectedvalue of the Treeview control will be retrieved from the hidden control, in this case, OK.
Related Article

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.