Asp.net page lifecycle explain in msdn

Source: Internet
Author: User
Http://msdn2.microsoft.com/en-us/library/ms178472.aspx

Here is the link about Asp.net page life-cycle and the following words need to pay attention

Catch-up events for added controls

For example, suppose you haveGridviewThat displays a company record in each row along with a list of the company officers inListBoxControl. To fill the list of officers, you wocould bindListBoxControl to a data source control (suchSqldatasource) That retrieves the company officer data using the companyid in a query.

If the ListBox Control's data-binding properties, such as datasourceid and datamember , are set Declaratively, the ListBox control will try to bind to its data source during the containing row's databinding event. however, the companyid field of the row does not contain a value until the gridview Control's rowdatabound event occurs. in this case, the child control (the ListBox Control) is bound before the containing control (the gridview Control) is bound, so their data-binding stages are out of sync.

To avoid this condition, put the data source control forListBoxControl in the same template item asListBoxControl itself, and do not set the data binding properties ofListBoxDeclaratively. Instead, set them programmatically at run time duringRowdataboundEvent, so thatListBoxControl does not bind to its data until the companyid information is available.

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.