473,395 Members | 1,516 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.

How to Add new Item into DropDownList after DataBind with Database ?

Now,the dropdownlist is binded with a DataSet object,
go on ,
I want to add a new item into DropDownList,
and let the new item in the first Postion,

like this:

-- All items -- //which I add
kjkljljljlk //which come from datset
jkjljl
jkjkljl
jkljljl
jkljasle

any help ?
--
FireCrow Studio
Kylin Garden
EMail:w0**@sohu.com
ICQ:156134382
Nov 19 '05 #1
2 2209
TJS

example code:
.....
EventList.DataSource = dtrList
EventList.DataTextField = ("EventName")
EventList.DataValueField = ("EventID")
EventList.DataBind()

' insert an item at the beginning of the list
'----------------------------------------------------
Dim NewItem As ListItem
EventList.Items.Insert(0, New ListItem("-- All Events --","-1"))

......



"Kylin" <w0**@sohu.com> wrote in message
news:%2***************@TK2MSFTNGP14.phx.gbl...
Now,the dropdownlist is binded with a DataSet object,
go on ,
I want to add a new item into DropDownList,
and let the new item in the first Postion,

like this:

-- All items -- //which I add
kjkljljljlk //which come from datset
jkjljl
jkjkljl
jkljljl
jkljasle

any help ?
--
FireCrow Studio
Kylin Garden
EMail:w0**@sohu.com
ICQ:156134382

Nov 19 '05 #2
TJS

example code:
.....
EventList.DataSource = dtrList
EventList.DataTextField = ("EventName")
EventList.DataValueField = ("EventID")
EventList.DataBind()

' insert an item at the beginning of the list
'----------------------------------------------------
Dim NewItem As ListItem
EventList.Items.Insert(0, New ListItem("-- All Events --","-1"))

......



"Kylin" <w0**@sohu.com> wrote in message
news:%2***************@TK2MSFTNGP14.phx.gbl...
Now,the dropdownlist is binded with a DataSet object,
go on ,
I want to add a new item into DropDownList,
and let the new item in the first Postion,

like this:

-- All items -- //which I add
kjkljljljlk //which come from datset
jkjljl
jkjkljl
jkljljl
jkljasle

any help ?
--
FireCrow Studio
Kylin Garden
EMail:w0**@sohu.com
ICQ:156134382

Nov 19 '05 #3

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

Similar topics

6
by: Umut K. | last post by:
Hi all, I've a DataList control and it's DataBound by a SqlDataReader... The Reader returns say 3 records and as expected the datalist shows 3 rows. What i want to do is to add another extra...
7
by: localhost | last post by:
A DataGrid with shows a label in one of the columns when in view mode. When in edit mode, I want to show a dropdown, and have the default selection set to what the textbox used to be. Right now...
5
by: DC Gringo | last post by:
I've got a command button to submit a value from a dropdown list that should then filter a SELECT query. I'm simply appending a WHERE colx = <variableSelectedFromDropdownList>. How do I pass this...
5
by: DC Gringo | last post by:
I have a dropdownlist that, upon form submission, I'd like to maintain the selected value when I get my result...how do I do that? <asp:dropdownlist Font-Size="8" id="ddlCommunities"...
3
by: Stephen Adam | last post by:
Hi there, I'm sure i'm missing something really simple here, all i want to do is get the value of the selected item in a list box. Even after much fiddling about last night I still could not get...
3
by: Tim::.. | last post by:
Can someone please tell me how I go about preselecting an item in a drop drown list when I click the Edit Command in a datagrid? I have tried the following but it doesn't work for me! I would...
4
by: dhnriverside | last post by:
Hi guys I've got a dropdownlist which is being databound to an sqldatareader at runtime. I want to add an extra Item to the list, not from the database. I know I can do this with ...
3
by: Iain | last post by:
Hi All I have 2 DropDownList boxes on a page. The first (id= "Operation") is populated on PageLoad with the contents of a database table. The second id="WorkStations" will not be populated...
4
by: rn5a | last post by:
I am binding a DropDownList with records existing in a database table. I want to add an extra item *SELECT COMPANY* at index 0 so that by default, it gets selected. This is how I tried it but the...
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:
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...
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
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.