📄 demo-variableglobal.aspx
字号:
<%@ Page Language="C#" Debug="true" %>
<script runat="server">
string strVariableGlobal = "Use me anyplace on the page";
void Page_Load()
{
string strMyVariable1 = "Block Variable Used In Block";
if (1==1)
{
string strMyVariable2 = "Block Variable Used In Block";
string strMyVariable3 = "Block Variable Used After Block";
lblMessageBlockInBlock.Text = strVariableGlobal;
} //End IF(1==1)
lblMessageProcedure.Text = strVariableGlobal;
SubProcedure2();
} //End Page_Load
void SubProcedure2()
{
lblMessageBlockOutBlock.Text = strVariableGlobal;
} // end SubProcedure2()
</script>
<html>
<head>
<title>Variable Scope</title>
</head>
<body>
<form runat="server">
<asp:Label id="lblMessageBlockInBlock" runat="server" text="DEFAULT - BlockInBlock"/>
<br />
<asp:Label id="lblMessageBlockOutBlock" runat="server" text="DEFAULT - BlockOutBlock"></asp:Label>
<br />
<asp:Label id="lblMessageProcedure" runat="server" text="DEFAULT - Procedure"></asp:Label>
<br />
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -