Get the App
SLTechnology News&Howtos  ›  Development  › 

How to modify the value of the master page control on the page page after referencing the master page

Shulou Source: shulou.com Published: 2022-06-03 05:34:29 09月22日 Update

Editor to share with you how to use the master page to modify the value of the master page control on the page page. I hope you will get something after reading this article. Let's discuss it together.

The specific conditions are as follows:

1. First, the page must refer to the master page to be modified

2. On the page page, create a strongly typed reference to the master page by setting the page directive @ MasterType, and specify the virtual path to generate the strongly typed file, for example:

The copy code is as follows:

3. Add a public property to the master page, and the set value is assigned to the master page control, for example:

The copy code is as follows:

Public string PageTitle

{

Set {

This.LabPageTitle.Text = value

}

}

After meeting the above conditions, you can modify the value of the control above the master page on the page page, for example:

The copy code is as follows:

Protected void Page_Load (object sender, EventArgs e)

{

If (! IsPostBack)

{

This.Master.PageTitle = "Page page modifies the value of the master page control"

}

}

In this way, the LabTitle control value on the Master page is set to "Page page modifies the value of the master page control".

After reading this article, I believe you have a certain understanding of "how to modify the value of the master page control on the page page after referencing the master page". If you want to know more about it, welcome to follow the industry information channel, thank you for your reading!

Tags: Controls pages code conditions articles types done properties instructions documents more knowledge industry information information channels paths channels Chengqiang Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Shulou Technology OPPO Reno MariaDB Huawei