Experience in creating dynamic controls

Source: Internet
Author: User

In the morning, I created a widget dynamically and found that:
1. When the PostBack operation is performed, repeat the dynamically created action. At this time, you can obtain the value of the previously created control. Using form, you cannot reference the controls set.
Thispage. Request. Form [controlid]
2. For controls such as Textbox, although a new value can be added during PostBack, the new value cannot be displayed in the result, but it is still the value before PostBack. The enableviewstate of the control is also disabled. It is suspected that viewstate will be restored after dynamic creation (that is, after page_load.
3. Methods for obtaining controls
Control CTL = contain. findcontrol (controlid );
If (CTL! = NULL) contain. Controls. Remove (CTL );

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.