473,395 Members | 1,468 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,395 software developers and data experts.

Databound DropDownList is Empty

For some reason my databound DropDownList will not populate. I've
tried a variety of things...here's the latest.

- I pulled a DropDownList on to the page.
- Then I pulled a SqlDataAdapter and set the select query to "SELECT *
FROM Items".
- I chose Generate DataSet... from the SqlDataAdapter's properties.
- I set the DataSource, DataMember, DataTextField, and DataValueField
properties in the Properties window.
- Then I put DropDownList1.DataBind() in the Page_Load event.

The DropDownList is empty, but if I go to the SqlDataAdapter and chose
"Preview Data" it shows the data properly.

I've also tried putting sqlDataAdapter1.Fill(DataSet1,"Items") in the
Page_Load event prior to the DropDownList1.DataBind() code.

Any help would be greatly appreciated. Thanks.

-Sean

Dec 6 '06 #1
3 1884
Is there any code actually telling the dataset to be populated with data?

This is why it is best to not use the designer. You end up relying on it to
do thing, and you have no idea what is actually going on. Just write the
data access code yourself, you will be better off.

"ssims" <se*******@gmail.comwrote in message
news:11**********************@80g2000cwy.googlegro ups.com...
For some reason my databound DropDownList will not populate. I've
tried a variety of things...here's the latest.

- I pulled a DropDownList on to the page.
- Then I pulled a SqlDataAdapter and set the select query to "SELECT *
FROM Items".
- I chose Generate DataSet... from the SqlDataAdapter's properties.
- I set the DataSource, DataMember, DataTextField, and DataValueField
properties in the Properties window.
- Then I put DropDownList1.DataBind() in the Page_Load event.

The DropDownList is empty, but if I go to the SqlDataAdapter and chose
"Preview Data" it shows the data properly.

I've also tried putting sqlDataAdapter1.Fill(DataSet1,"Items") in the
Page_Load event prior to the DropDownList1.DataBind() code.

Any help would be greatly appreciated. Thanks.

-Sean

Dec 6 '06 #2
I agree with MArina.
By the way have u wrapped the code in !Page.Postback. in the Page_load?
Patrick

"ssims" <se*******@gmail.comwrote in message
news:11**********************@80g2000cwy.googlegro ups.com...
For some reason my databound DropDownList will not populate. I've
tried a variety of things...here's the latest.

- I pulled a DropDownList on to the page.
- Then I pulled a SqlDataAdapter and set the select query to "SELECT *
FROM Items".
- I chose Generate DataSet... from the SqlDataAdapter's properties.
- I set the DataSource, DataMember, DataTextField, and DataValueField
properties in the Properties window.
- Then I put DropDownList1.DataBind() in the Page_Load event.

The DropDownList is empty, but if I go to the SqlDataAdapter and chose
"Preview Data" it shows the data properly.

I've also tried putting sqlDataAdapter1.Fill(DataSet1,"Items") in the
Page_Load event prior to the DropDownList1.DataBind() code.

Any help would be greatly appreciated. Thanks.

-Sean

Dec 7 '06 #3
I thnk u missed out the DataTextField Property.Just check that..

Regards
Priyabrata
Patrick.O.Ige wrote:
I agree with MArina.
By the way have u wrapped the code in !Page.Postback. in the Page_load?
Patrick

"ssims" <se*******@gmail.comwrote in message
news:11**********************@80g2000cwy.googlegro ups.com...
For some reason my databound DropDownList will not populate. I've
tried a variety of things...here's the latest.

- I pulled a DropDownList on to the page.
- Then I pulled a SqlDataAdapter and set the select query to "SELECT *
FROM Items".
- I chose Generate DataSet... from the SqlDataAdapter's properties.
- I set the DataSource, DataMember, DataTextField, and DataValueField
properties in the Properties window.
- Then I put DropDownList1.DataBind() in the Page_Load event.

The DropDownList is empty, but if I go to the SqlDataAdapter and chose
"Preview Data" it shows the data properly.

I've also tried putting sqlDataAdapter1.Fill(DataSet1,"Items") in the
Page_Load event prior to the DropDownList1.DataBind() code.

Any help would be greatly appreciated. Thanks.

-Sean
Dec 7 '06 #4

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

Similar topics

4
by: Harold | last post by:
I have read the following article http://www.4guysfromrolla.com/webtech/073101-1.shtml. I added the empty selection as the first option. When I click submit without choosing anything it does not...
6
by: dbuchanan | last post by:
VS2005 I've been reading all the help I can on the topic (MSDN, other) but I can't make sense of this. Desired behavior; The user is to choose from the displayed list of the databound combobox...
9
by: Jakob Lithner | last post by:
1) I have a DataGridView with edit capability. But in some columns I want to limit the input with a DropDownList. There is no inbuilt column for DropDownLists so I intended to add one myself. I...
2
by: cider123 | last post by:
I have a SqlDataSource bound to a DropDownList Combo. Works just fine. I noticed 2 properties you can set in the DropDownList, 1 for the value to be displayed in the "Text" column and 1 for the...
1
by: DJ | last post by:
I have a DropDownList in Visual Web Developer that is databound to a SQL Database. Whenever the web page is opened the DropDownList is automatically filled with the first item in the table. My...
5
by: maurban | last post by:
Hi there experts, I have a gridview with a couple textboxes and a dropdownlist. I'm trying to insert a default value into my database driven dropdownlist. I'm doing this in the rowdatabound...
0
by: Mark Micallef | last post by:
Hi, I'm having a problem using a databound dropdownlist inside a reorderlist ajax control. Here's a snippet of the code I'm using: <InsertItemTemplate> <div class="insertArea">...
1
by: Mark Micallef | last post by:
Hi, this question relates to a control in the Ajax toolkit for asp.net 2. I'm having a problem using a databound dropdownlist inside a reorderlist ajax control. Here's a snippet of the code I'm...
2
by: Cirene | last post by:
In my databound datagrid i have a databound dropdownlist, like this: <asp:DropDownList ID="ddlAvail0" runat="server" SelectedValue='<%# Bind("AvailMon") %>'> <asp:ListItem></asp:ListItem>...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.