Function local variable (C#) : Function « Language Basics « ASP.Net

Home
ASP.Net
1.ADO.net Database
2.Ajax
3.Asp Control
4.Collections
5.Components
6.Data Binding
7.Development
8.File Directory
9.HTML Control
10.Language Basics
11.Login Security
12.Mobile Control
13.Network
14.Page
15.Request
16.Response
17.Server
18.Session Cookie
19.Sitemap
20.Theme Style
21.User Control and Master Page
22.Validation by Control
23.Validation by Function
24.WebPart
25.WPF
26.XML
ASP.Net » Language Basics » Function 
Function local variable (C#)

<script Language="c#" runat="server">
  void Page_Load()
  {
    message1.Text="";
    message1.Text+="<BR />Calling Function 1...";
    Function1();
    message1.Text+="<BR />Calling Function 2...";
    Function2();
    message1.Text+="<BR />Calling Function 1...";
    Function1();
  }
  void Function1()
  {
    string Different = 
                "<i>Hello I'm the variable Different in Function 1</i>";
    message1.Text+= Different;
  }
  void Function2()
  {
    string Different = 
                "<b>Hello I'm the variable Different in Function 2</b>";
    message1.Text+= Different;
  }
</script>
<html>
<head>
<title>Scope</title>
</head>
<body>
<asp:label id="message1" runat="server"/>
</body>
</html>

           
       
Related examples in the same category
1.Define and call function in a page (VB.net)
2.Page level procedure (VB.net)
3.Define function to change 'HR' length (C#)
4.Function Parameter passed by Reference (C#)
5.Function Parameter passed by Value (C#)
6.Using out Parameters (C#)
7.Simple function without parameters (C#)
8.Define and call function (C#)
9.Call function (C#)
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.