The button event on the master page gets the content of the Child page, and the button event gets

Source: Internet
Author: User

The button event on the master page gets the content of the Child page, and the button event gets

This example shows how to obtain the content of some subpages by using the button event on the master page.
In the master, there is an button event. When you browse some subpages, you can click the button on the master page to obtain the content of the current page.

There are many subpages, but we do not get the content of each subpage, and the content of each subpage is different. Therefore, you need to let the parent page events know which child pages need to be obtained.

To put it bluntly, this is what we call interfaces. Let different objects process the same behavior.

Let's take a look at this interface:

 

Using System; using System. collections. generic; using System. linq; using System. web; // <summary> /// Summary description for IGetSubPageContentable /// </summary> namespace Insus. NET {public interface IGetSubPageContentable {string GetResult () ;}} Source Code


Next, all the subpages for Interface Behavior execution must implement the above interface:

Default. aspx. cs:

 

Default1.aspx. cs:



Default2.aspx. cs:

 

Default3.aspx. cs:

 

The subpage of the demo is like this to implement the interface.

Next, for the button event on the master page, I need to know which subpages have implemented interfaces:

 

OK. Key procedures and implementation processes are shared in the blog. All. aspx and. master can be used freely!

Real-time Demonstration:

 

 

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.