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

add a list item to a bound control?

Hi,

I have a drop down list thats bound to a SQL query. But I want to have
the top item or .SelectedItem to be a generic "Please Select..." with
no value. I've searched for the answer and tried every combination and
can't find an answer.

I've tried adding <ASP:ListItem> to the control but the bound data
overides it.

I'm using .NET with VB, Any suggestions?

Feb 14 '06 #1
2 1033
jr***@blackstaronline.net wrote:
Hi,

I have a drop down list thats bound to a SQL query. But I want to have
the top item or .SelectedItem to be a generic "Please Select..." with
no value. I've searched for the answer and tried every combination and
can't find an answer.

I've tried adding <ASP:ListItem> to the control but the bound data
overides it.

I'm using .NET with VB, Any suggestions?


Don't bind the object to the SQL. Just loop through the sql and add the
items in yourself. That way you'll can add your item at the top.

Chris
Feb 14 '06 #2
Thanks Chris,

Actually I figured it out and it seems for this instance a little
easier than looping through the results. All I had to do was add this
one line after I bound the data to the control.

mydropdown.Items.Insert(0,New ListItem("Please Select...",""))

Feb 14 '06 #3

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

Similar topics

0
by: Dunc | last post by:
I've bound a series of drop-down lists in a repeater control to a data table. I've late bound them to datatable, and am using the _ItemDataBound event to populate each control accordingly, and...
3
by: Dmitry Korolyov [MVP] | last post by:
Is that possible? In other words, I want a dropdown list (and other list-type controls) which appears in edit more of a templated column to be populated with data at the run time. An attempt to do so...
1
by: Shahid Saleem | last post by:
Dear Members I want to generate a Template using DataList and i want to user Grid control in the item template, is it possible. if yes need some explanation regarding data binding of grid...
2
by: Alfredo Barrientos | last post by:
Hi, I have been reading information about asp.net webcontrols, and i have found a term "List bound controls". What are "List Bound Controls"?? Which are the differences between these controls...
11
by: Brian Henry | last post by:
Well here is the problem, I have a data set with about 9,000 to 20,000 people in it in the data table "people"... I am then reading it into a list view one at a time row by row... adding each...
1
by: Alex K. | last post by:
Hi all How do I catch an event when list item is deleted from ListBox? Is there such event? Thank you Alex
2
by: clickon | last post by:
I am using ASP.net 2.0 and trying to take advantage of the updated data editing facilities provided through the SQLDataSource control and the DetailsView control. The data is a record from a...
4
by: John | last post by:
Hi I have a form which is bound to a query with some bound controls. On the same form I also have a list bound to the same query. How can I sync the controls on the form with the list such that...
1
by: Nestor01 | last post by:
I use a lookup table which contacts 2 fields (item#, name) When a customer places an order, the order form contains a drop down to select the item by name (from the lookup table). The detail is...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.