473,322 Members | 1,431 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Problem getting a DropDownList populated by query(beginner)

Hi,
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
me.

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
SqlConnection(ConfigurationSettings.AppSettings["SqlConnect"]);

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";
ddlRSL.DataBind();
}

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
0 921

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Art | last post by:
NEWBIE ALERT! Esteemed List Participants and Lurkers: (System: P-II 350, 192 meg, Win98 SE, Python 2.2.3, wxPythonWIN32-2.4.1.2-Py22.exe) I'm having a lot of fun getting started with Python...
3
by: Larry Smith | last post by:
I'm just doing some experimentation to learn the ins and outs of resources in .NET and am having a minor problem (OS=Win2000). I've prepared both an "en-US" subdirectory and an "en-CA" subdirectory...
1
by: David | last post by:
I have developed a very simple aspx that simply looks like: <%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="WebApps1.WebForm1" aspCompat="True"%> <!DOCTYPE...
3
by: vbGansta | last post by:
Hi there, I just started programming with .net a few weeks ago. I have a webform that has a few controls on it. I would like the user to be able to select a month from the first drop down and...
3
by: Rodney Garland | last post by:
Hi All, I am a relative beginner to Python and am looking for help with sending and XML message and getting back a return file. The server is: https://node.deq.state.or.us/node/node.asmx I...
13
by: Ranginald | last post by:
I am new to oop so please bear with me: Could someone please explain to me why the "protected void runCategory() method" cannot access the local ddlCategory object that is easily accessed in...
0
by: Ranginald | last post by:
How could I go about creating a custom event handler for a web controls method (e.g. OnSelectedIndexChanged) and have that method say, ItemChanged() -- be called from a separate class (for...
1
by: 47computers | last post by:
I have a couple of DropDownLists in a DetailsView control (your classic country/state lists) and I need one to be populated based on the current selection of the other. Currently this works fine...
2
by: Riaaaa | last post by:
I m beginner for ASP.Net 2005 with C# and SQL Server 2005. I have created the form which contains many asp standard controls on it like label,textbox,checkbox,dropdownlist,command button. The...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.