Mega Code Archive

 
Categories / ASP.Net / Collections
 

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>