Simple function without parameters (C#) : Function « Language Basics « ASP.Net






Simple function without parameters (C#)

<%@ Page Language="C#" Debug="true" %>
<script runat="server">

    void Page_Load()
    {
        lblMessage.Text = "First Line";
        InsertLinebreak();
        lblMessage.Text += "Second Line";
        InsertLinebreak();
        lblMessage.Text += "Third Line";
        InsertLinebreak();
    }
    
    void InsertLinebreak()
    {
        lblMessage.Text += "<br><hr>";
    }

</script>
<html>
<head>
    <title>Simple Function Example</title>
</head>
<body>
    <form runat="server">
        <asp:Label id="lblMessage" runat="server"></asp:Label>
    </form>
</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.Define and call function (C#)
8.Call function (C#)
9.Function local variable (C#)