Mega Code Archive

 
Categories / ASP.Net / Language Basics
 

Define and call function (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>in Function 1</i>";     message1.Text+= Different;   }   void Function2()   {     string Different = "<b>in Function 2</b>";     message1.Text+= Different;   } </script> <html> <head> <title>Scope</title> </head> <body> <asp:label id="message1" runat="server"/> </body> </html>