How to call the content page on the ASP. NET master page

Source: Internet
Author: User

First, define the delegate (delegate) on the master page ):

Namespace notsee. Web. Manage
{
Public partial class SYS: system. Web. UI. masterpage
{
Public Delegate void elementselectedchangehandler ();
// Instantiate the delegate, which is actually an attribute
Public elementselectedchangehandler elementselectedchange {private get; set ;}
Protected void page_load (Object sender, eventargs E)
{// Notsee.info Technical Exchange
}
// Buttons in the master
Protected void btnsearch_click (Object sender, eventargs E)
{
If (elementselectedchange! = NULL)
{
Elementselectedchange ();
}
}
}
}

For example, on the notsee. aspx content page, we need to specify a method that matches the delegate signature in the notsee. ASPX page:
Namespace WMS. Web. Manage
{
Public partial class notsee: system. Web. UI. Page
{
Master. elementselectedchange = This. elementselectedchange;
Protected void page_load (Object sender, eventargs E)
{// Notsee.info Technical Exchange
}
Void elementselectedchange ()
{
// Your solution
}
}
}
In summary, here we use the principle of delegation (the design principle of dependency inversion. That is, to define a general framework for future generations to addCode).

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.