How ASP. NET dynamically loads controls to stimulate events

Source: Internet
Author: User

Previous Article <asp. NET Dynamic Loading Control> mentioned the control time loading and registration time, And the PostBack problem. in addition to the above two problems, the Control ID problem is easily overlooked.
In a Dynamically Loaded control, several more dynamically added buttons need to be clicked twice to trigger the event. However, if you add these dynamically added buttons directly to the page rather than the control, then everything is normal and very depressing. after hard work, I found that it would be normal to assign values to the ID attribute of the dynamically added button. If no value is assigned to the ID, Asp. net will automatically assign an ID to the control. Different ID values may be assigned during two PostBack operations. This causes the event to be triggered only when two buttons are specified. therefore, we should not be lazy when doing dynamic controls. We must specify a value for the ID. Otherwise, such hidden errors will actually be tortured. 87d9a686

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.