If you need to leave a certain custom space for the user, for example, if the user wants to use his own style sheet or title for the page, you can use the following method to dynamically specify it:
First, modify the page title and style sheet in <HEAD> in the ASPX file.
Code generated by Visual Studio:
<title>WebForm1</Title>
<LINK ref="stylesheet" type="text/css" href="">
Modified code:
<title runat="server" >WebForm1</title>
<LINK runat="server" type=text/css" ref="stylesheet"></link>
We add both HTML elements to runat=server and mark them as server-side controls to enable us to access them in the server code.
In the file, we can use C# code to control the line
private void Button1_Click(object sender, e)
{
Control ctrl=("Title1"); //Look for the Title we just modified to runat=server
((HtmlGenericControl)ctrl).InnerText="Hello";
ctrl=("link1");
((HtmlGenericControl)ctrl).("href","");
}
Through the above steps, you can dynamically change the page title and dynamically specify the page style sheet.
First, modify the page title and style sheet in <HEAD> in the ASPX file.
Code generated by Visual Studio:
<title>WebForm1</Title>
<LINK ref="stylesheet" type="text/css" href="">
Modified code:
<title runat="server" >WebForm1</title>
<LINK runat="server" type=text/css" ref="stylesheet"></link>
We add both HTML elements to runat=server and mark them as server-side controls to enable us to access them in the server code.
In the file, we can use C# code to control the line
private void Button1_Click(object sender, e)
{
Control ctrl=("Title1"); //Look for the Title we just modified to runat=server
((HtmlGenericControl)ctrl).InnerText="Hello";
ctrl=("link1");
((HtmlGenericControl)ctrl).("href","");
}
Through the above steps, you can dynamically change the page title and dynamically specify the page style sheet.