For loop in asp.net c#

For loop
ForLoopExample.aspx

<%@ Page Language="C#" %>

<!DOCTYPE html>

<script runat="server">
    protected void Page_Load(object sender, System.EventArgs e) {
        for (int i = 1; i < 11; i++) {
            Label1.Text += i + ", ";
        }

        string[] Colors = { "Red", "Pink", "Green", "Yellow", "Gray" };
        for (int i = 0; i < Colors.Length; i++) {
            Label2.Text += Colors[i] + " ";
        }
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>asp.net for loop example: using for loop</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h2 style="color:Red"> for loop example</h2>
        <asp:Label ID="Label1" runat="server" Font-Size="Large" ForeColor="HotPink"></asp:Label>
        <br /><br />
        <asp:Label ID="Label2" runat="server" Font-Size="Large" ForeColor="Teal"></asp:Label>
    </div>
    </form>
</body>
</html>
More asp.net examples