How to get ConnectionStrings list programmatically in asp.net
GetConnectionStrings.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) {
ListBox1.DataSource = System.Web.Configuration.WebConfigurationManager.ConnectionStrings;
ListBox1.DataBind();
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>How to get ConnectionStrings list programmatically in asp.net</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2 style=" color:Fuchsia">Get ConnectionStrings List Example</h2>
<br />
<b>ConnectionStrings</b>
<br />
<asp:ListBox ID="ListBox1" runat="server"></asp:ListBox>
<br /><br />
<asp:Button ID="Button1" runat="server" Text="Get ConnectionStrings List" OnClick="Button1_Click" />
</div>
</form>
</body>
</html>
- asp.net Button example: how to use OnClientClick event
- asp.net class file example: how to use class, method, argument in asp.net
- asp.net class file example: a sample simple class file CalculatorClass.cs
- Asp.Net PlaceHolder example: how to add control programmatically
- Asp.Net PlaceHolder example: how to use PlaceHolder Control
- asp:Label example: using Label control in asp.net
- Label Example: how to generate text in Page_Load event
- Label control example: how to design Label control in asp.net
- Label Example: Using AssociatedControlID property in asp.net
- Label Example: Using AccessKey property in Label control