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

dropdown list box

I have a list box that is bound to a table and displays names. I would like
to have it also display and item that is not in the DB

I want it to display an option for ALL, and still display the names? How can
i do this in C#/ASP.NET
Nov 18 '05 #1
2 902
<<I have a list box that is bound to a table and displays names. I would
like
to have it also display and item that is not in the DB

I want it to display an option for ALL, and still display the names? How
can
i do this in C#/ASP.NET>>

I have it in VB, but this works for me:

' do a databind to select items to display.

If lbRG.Items.Count > 0 Then

Dim txtRGAll As String

txtRGAll = "All Report Groups in " & BA

lbRG.Items.Insert(0, txtRGAll)

lbRG.Items(0).Value = "0"

End If

lbRG.Rows = lbRG.Items.Count

Dim x As Integer

If lbRG.SelectedIndex > -1 Then

For x = 0 To lbRG.Items.Count - 1

If lbRG.Items(x).Value = sSelect Then

lbRG.SelectedIndex = x

End If

Next

End If

Basically, I just insert a record in the listbox at Zero. In the onclick
event for the next one you'll have to monitor for it selecting all of the
items in that listbox.

SC
Nov 18 '05 #2


Hi,
I have tried doing this with drop down lists....it might be similar for
listbox also...heres wat i did,,.

ddl1.DataSource=dr;
..
..
ddl1.Databind();
ddl1.Items.Add("All");
This will add all to the dropdownlist in addition to watever the
datasource provides.

HTH,
Ben

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #3

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

Similar topics

1
by: Joseph Barron | last post by:
Here is a SIMPLE problem that I'm trying to solve. It works in Netscape 6.2, but IE6 gives ""No such interface supported." Below are page1.htm and page2.htm . In page1.htm, there are two...
2
by: Mike Collins | last post by:
I cannot get the correct drop down list value from a drop down I have on my web form. I get the initial value that was loaded in the list. It was asked by someone else what the autopostback was...
5
by: jung_h_park | last post by:
From: jung_h_park@yahoo.com Newsgroups: microsoft.public.dotnet.framework.aspnet Subject: Dropdown List not retaining its SelectedValue Date: Mon, 26 Jun 2006 21:02:57 -0700 Hello, My...
3
by: er1 | last post by:
Hi all, I have created a double dropdown list. Based on the first list selection, second list populates (this works fine). I have a submit button, which when clicked should run a select query...
3
by: fish919 | last post by:
Hello All, I am creating a date base in access. I want to create a dropdown list box that is connected to another dropdown list box. You start with a dropdown list that has 5 choices and each of...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...

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.