asp.net example: get the ConnectionStrings List programmatically
ConnectionStringsList.aspx
<%@ 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">
protected void Button1_Click(object sender, System.EventArgs e) {
GridView1.DataSource = System.Web.Configuration.WebConfigurationManager.ConnectionStrings;
GridView1.DataBind();
Label1.Text = "ConnectionStrings List Found.";
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Asp.Net Example: get the ConnectionStrings List programmatically</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2 style="color:Fuchsia">Get ConnectionStrings</h2>
<asp:Label ID="Label1" runat="server" Font-Size="Large" ForeColor="DarkCyan"></asp:Label>
<br />
<asp:GridView ID="GridView1" runat="server" CellPadding="4" ForeColor="#333333"
GridLines="None">
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="#EFF3FB" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#2461BF" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
<br />
<asp:Button ID="Button1" runat="server" Text="Get ConnectionStrings List" OnClick="Button1_Click" Font-Bold="true" ForeColor="DarkGreen" />
</div>
</form>
</body>
</html>
- asp.net ListBox: how to remove list Item programmatically
- asp.net ListBox: how to add List Item programmatically
- asp.net Image: how to use
- asp.net HyperLink: how to use
- asp.net CheckBox: how to use
- asp.net Button: how to use
- DropDownList and Array example: populating a DropDownList with Array DataSource
- HyperLink Control example: how to use HyperLink in asp.net
- Session Example: how to use Session in asp.net
- How to create and use User Control in asp.net