Use String Array to store Asp Label Text (C#) : Array « Collections « ASP.Net






Use String Array to store Asp Label Text (C#)

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

    void Page_Load()
    {

    string [] strMarx = new string[6];
    strMarx[0] = "A";
    strMarx[1] = "B";
    strMarx[2] = "C";
    strMarx[3] = "D";
    strMarx[4] = "E";
    strMarx[5] = "F";
    
    lblMarx.Text = strMarx[3];

    string [] strFriends = new string[5];
    strFriends[1] = "Mr. J";
    strFriends[4] = "Mr. G";
    strFriends[3] = "Mrs. S";
    lblFriend.Text = strFriends[4];

    }

</script>
<html>
<head>
    <title>Array Example</title>
</head>
<body>
    <form runat="server">
        A Marx Brother: 
        <asp:Label id="lblMarx" runat="server"></asp:Label><br>
        A friend: 
        <asp:Label id="lblFriend" runat="server"></asp:Label><br>
    </form>
</body>
</html>

           
       








Related examples in the same category

1.Array Reverse Demo (VB.net)
2.For Each loop through an Array (VB.net)
3.Array.IndexOf and Array.LastIndexOf (VB.net)
4.Get array by index (VB.net)
5.Sort an Array (VB.net)
6.For each loop: array (VB.net)
7.Change array length (VB.net)
8.Define and use array (VB.net)
9.Sort array reversely (C#)
10.Get array element by index (C#)
11.Array.IndexOf(), Array.LastIndexOf() (C#)
12.Use Two dimensional array (C#)
13.Use array: find item index (C#)