By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,369 Members | 950 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,369 IT Pros & Developers. It's quick & easy.

Problem getting a DropDownList populated by query(beginner)

P: n/a
I am trying to get a DropDownList to be populated by a simple query, but I
cannot see why it doesn't work, I was hoping someone can shed some light for

Here's my C# code:

private void Page_Load(object sender, System.EventArgs e)
//strConn = ConfigurationSettings.AppSettings["SqlConnect"];
DataSet ds = new DataSet();
DataView dv = new DataView();

SqlConnection objConn = new

SqlDataAdapter myDataAdapter = new SqlDataAdapter("SELECT RSL, FullName
FROM tbl_Contacts_2005", objConn);
myDataAdapter.Fill(ds, "RSLNames");
dv = ds.Tables["RSLNames"].DefaultView;
ddlRSL.DataSource = dv;
ddlRSL.DataValueField = "RSL";
ddlRSL.DataTextField = "FullName";

And heres my DropDownList tag:

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

I cannot see why it doesn't work.

Any ideas?
Nov 19 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.