dyncidiorry
New Member
I have this DataList<BR><ASP
ataList id="dlState" runat="server"><BR><ItemTemplate><BR><%# DataBinder.Eval(Container.DataItem, "State") %><BR></ItemTemplate><BR></ASP
ataList><BR><BR>It works and prints all the states. I tryed this:<BR><Select name="state"><BR><ASP
ataList id="dlState" runat="server"><BR><ItemTemplate><BR><option value=http://aspmessageboard.com/archive/index.php/"<%# DataBinder.Eval(Container.DataItem, "ST") %>"><BR><%# DataBinder.Eval(Container.DataItem, "State") %><BR></option><BR></ItemTemplate><BR></ASP
ataList><BR></select><BR><BR>But I get a blank drop down and a list of state below the drop down. Does anyone know how to tie these two together? <BR>ThanksIf you just want a listBox of states (from the code you posted), why the need for a DataList? Can't you just use an asp:listbox and bind a dataset to it?<BR><BR>Can You show me how?here is a simple example that I wrote. The general idea is:<BR><BR>1. Get back some XML from my DataAccessLayer<BR>2. Load the XML into a dataset<BR>3. bind the dataset to a listbox<BR><BR>----------------------------------------------------------<BR><%@ Page Language="vb" %><BR><%@ Import Namespace="System" %><BR><%@ Import Namespace="System.Data" %><BR><%@ Import Namespace="System.Data.OleDb" %><BR><%@ Import Namespace="System.IO" %><BR><%@ Import Namespace="System.XML" %><BR><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><BR><script runat="server"><BR>sub page_load(obj as object, e as eventArgs)<BR> dim objDAL as new DataAccessLayer.ElityDataAccess.DataAccess<BR> dim strSQL as string = "SELECT USERID, USERNAME FROM g_users"<BR> dim strXML as string<BR> dim objDS as dataset = new Dataset()<BR> Dim xmlSR As System.IO.StringReader <BR><BR> objDAL.mstrConnection = configurationSettings.appSettings("roleConn")<BR> <BR> if objDAL.selectSQL(strSQL, strXML) then<BR> xmlSR = New System.IO.StringReader(strXML)<BR> objDS.ReadXml(xmlSR)<BR> else<BR> response.write("ERROR:" & vbcrlf & strXML)<BR> exit sub<BR> end if<BR> <BR> lbOne.datasource = objDS<BR> lbOne.databind()<BR> objDAL = nothing<BR>end sub<BR></script><BR><HTML><BR> <body MS_POSITIONING="GridLayout"><BR> <form id="Form1" method="post" runat="server"><BR> <asp:ListBox ID="lbOne" Runat="server" DataTextField="userName" DataValueField="userID" SelectionMode="Single" Rows="1"/><BR> </form><BR> </body><BR></HTML><BR>thanks.



