Click to See Complete Forum and Search --> : Aspx in Notepad - populate a dropdown with SQL DB & query


ISMAILC
10-09-2009, 03:01 AM
Good , I need help.

I have a blank aspx page where I want to add a drop down down from a sql database and get selection of dropdwon value.

Coding in Notepad & not in Visual Studio

I tried this example http://www.webconcerns.co.uk/asp/combo/combo.asp that uses javscript but it connect to an access db.

How can I in a notepad edited aspx page

1. connect to a sql db

2. Create & populate a dropdown

3. textbox to show selected dropdown value.

This is all I have in the page:

<%@ Control Language="c#" AutoEventWireup="True" Codebehind="MainMenu.ascx.cs" Inherits="FlowCentric.Net.Navigator.MainMenu" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
<%@ Register Assembly="Infragistics2.WebUI.UltraWebNavigator.v8.1, Version=8.1.20081.1000, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" Namespace="Infragistics.WebUI.UltraWebNavigator" TagPrefix="ignav" %>
<meta name="vs_snapToGrid" content="False">


<asp:DropDownList id="DropDownList1" runat="server"></asp:DropDownList>

Please Help

ryanbutler
10-09-2009, 02:28 PM
You need to ditch notepad and go w/ a free version of Visual Studio, such as Visual Web Developer Express. Notepad just isn't going to cut it in this framework.

ISMAILC
10-12-2009, 06:35 AM
Thank You All - I got it going

[code:]

<asp:DropDownList ID="DropDownList1" Runat="server" DataSourceID="SqlDataSource1" OnSelectedIndexChanged="button1_Click"
DataTextField="processid" DataValueField="processid" AutoPostBack="True">
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource1" Runat="server"
ConnectionString="data source=srv2; initial catalog=MIS; user id=ic; password=ic;"
SelectCommand="select distinct ProcessID from dbo.fcEvent"></asp:SqlDataSource>

<script runat="server">
protected void button1_Click(object sender, EventArgs e)
{
if (DropDownList1.SelectedItem.Value !="View Process")
{

Session["mytext"] = DropDownList1.SelectedItem.Value;
Response.Redirect("myAdvancedTracking.aspx");

}
}
</script>
[/code:]

Thanks :)