block-level variables (C#) : Variable Scope « Language Basics « ASP.Net






block-level variables (C#)

<%@ Page Language="c#" %>
<script runat="server">

void Page_Load()
{
  if(1==1)
  {
      string strBlockLevelVariable;
      strBlockLevelVariable = "Very Short Lived!";
  
      lblMessage.Text = strBlockLevelVariable;

  }


}
</script>
<html>
<head>
<title>Creating Variables Example</title>
</head>
<body>
    <asp:Label runat="server" ID="lblMessage"/><br/>
</body>
</html>

           
       








Related examples in the same category

1.Local variable inside a function (VB.net)
2.Page level variable and function level variable (VB.net)
3.Define page level variables (VB.net)
4.Function Level variables (C#)
5.Page Level Variable (C#)