How do I operate controls on a page in a user control?

Source: Internet
Author: User
In general, we will focus on implementing functions in the ascx file so that the functions can be used for multiple times. However, in some cases, we may use operations on the page container where the user control is located.

In fact, if you think about it, the principle is also very simple. If ascx is used, it will appear in the page container, you can call the findcontrol method to operate the corresponding control through the page attribute of the class of the ascx.

There is another problem. We often encounter that when we click a button on the page, we find that the corresponding event is not executed, usually because the page initialization engine initializecomponent (); no event is registered.

In another case, there are two forms in An ASPX page, one of which does not have runat = server, and the corresponding button after it appears does not have a response. I am not quite familiar with the specific reasons. But at least the result is that the subsequent events are not sent back to the server.

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.