View Code
protected void Page_Load(object sender, EventArgs e)
{
DataTable dataTable = SqlDataSourceEnumerator.Instance.GetDataSources();
foreach (DataRow dr in dataTable.Rows)
{
if (string.IsNullOrEmpty(dr["InstanceName"].ToString()))
this.DropDownListInstance.Items.Add(string.Concat(dr["ServerName"]));
else
this.DropDownListInstance.Items.Add(string.Concat(dr["ServerName"], "", dr["InstanceName"]));
}
}