473,320 Members | 1,612 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,320 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 2206
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
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...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.