<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
private string[] controls = { "ListView", "GridView", "DetailsView", "FormView", "LinqDataSource", "EntityDataSource" };
protected void Page_Load(object sender, System.EventArgs e) {
if(!this.IsPostBack)
{
Label1.Text = "String array created successfully!<br />Array elements:<br /><br />";
foreach (string element in controls)
{
Label1.Text += element + "<br />";
}
}
}
protected void Button1_Click(object sender, System.EventArgs e)
{
Label2.Text = "Array [2] Index Value: " + controls[2];
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>How to get string array specific index position value in asp.net</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2 style="color:Green">asp.net array example:<br />String Array Specific Index Positin Value</h2>
<asp:Label
ID="Label1"
runat="server"
Font-Size="Large"
ForeColor="HotPink"
Font-Bold="true"
Font-Italic="true"
>
</asp:Label>
<br />
<asp:Label
ID="Label2"
runat="server"
Font-Size="Large"
ForeColor="DodgerBlue"
Font-Bold="true"
Font-Italic="true"
>
</asp:Label>
<br /><br />
<asp:Button
ID="Button1"
runat="server"
OnClick="Button1_Click"
Font-Bold="true"
Text="Get Array [2] Value"
ForeColor="SeaGreen"
/>
</div>
</form>
</body>
</html>
Thursday, 29 September 2011
How to get string array specific index position value in asp.net
Subscribe to:
Post Comments (Atom)


No comments:
Post a Comment