I have a dropdown list box with list of item. When I read the data from
database I want to display that value(one of the item in the drop down box)
in the dropdown list box.
How to do that in a dropdown list box ?
San 6 1536
I think you can add an item to your DropDown list by:
DrpList.Items.Add(New ListItem(strVar1,strVar2))
The strVar1 is the Text, and strVar1 is the Value. I believe if you leave strVar2 out, the Value
will default to strVar1.
If you need to replace an existing item in a specific index location, I think you can use:
DrpList.Item.Items(ndx).Text = strVar1
DrpList.Item.Items(ndx).Value = strVar2
I'm pretty sure there must be an list item already at the ndx location, though.
George
"San Smith" <Sa********@yahoo.com> wrote in message news:%2****************@TK2MSFTNGP12.phx.gbl... I have a dropdown list box with list of item. When I read the data from database I want to display that value(one of the item in the drop down box) in the dropdown list box. How to do that in a dropdown list box ? San
George,
I already have an index item in the list box.How to set the existing index
item to display ?
San
"George" <------@----.---> wrote in message
news:iU*******************@bgtnsc05-news.ops.worldnet.att.net... I think you can add an item to your DropDown list by:
DrpList.Items.Add(New ListItem(strVar1,strVar2))
The strVar1 is the Text, and strVar1 is the Value. I believe if you leave
strVar2 out, the Value will default to strVar1.
If you need to replace an existing item in a specific index location, I
think you can use: DrpList.Item.Items(ndx).Text = strVar1 DrpList.Item.Items(ndx).Value = strVar2
I'm pretty sure there must be an list item already at the ndx location,
though. George
"San Smith" <Sa********@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl... I have a dropdown list box with list of item. When I read the data from database I want to display that value(one of the item in the drop down
box) in the dropdown list box. How to do that in a dropdown list box ? San
Dim ndx as integer = 2
DrpList.SelectedIndex = ndx
George
"San Smith" <Sa********@yahoo.com> wrote in message news:uj**************@TK2MSFTNGP10.phx.gbl... George, I already have an index item in the list box.How to set the existing index item to display ? San
"George" <------@----.---> wrote in message news:iU*******************@bgtnsc05-news.ops.worldnet.att.net... I think you can add an item to your DropDown list by:
DrpList.Items.Add(New ListItem(strVar1,strVar2))
The strVar1 is the Text, and strVar1 is the Value. I believe if you leave strVar2 out, the Value will default to strVar1.
If you need to replace an existing item in a specific index location, I think you can use: DrpList.Item.Items(ndx).Text = strVar1 DrpList.Item.Items(ndx).Value = strVar2
I'm pretty sure there must be an list item already at the ndx location,
though. George
"San Smith" <Sa********@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl... I have a dropdown list box with list of item. When I read the data from database I want to display that value(one of the item in the drop down box) in the dropdown list box. How to do that in a dropdown list box ? San
If I have several items in the drop down list box(driven by database), is
there anyway of identifying a particular items index number. If so.... Then
I an set SelectedIndex number.
I appriciate your help
San.
"George" <------@----.---> wrote in message
news:Gx********************@bgtnsc04-news.ops.worldnet.att.net... Dim ndx as integer = 2
DrpList.SelectedIndex = ndx
George
"San Smith" <Sa********@yahoo.com> wrote in message
news:uj**************@TK2MSFTNGP10.phx.gbl... George, I already have an index item in the list box.How to set the existing
index item to display ? San
"George" <------@----.---> wrote in message news:iU*******************@bgtnsc05-news.ops.worldnet.att.net... I think you can add an item to your DropDown list by:
DrpList.Items.Add(New ListItem(strVar1,strVar2))
The strVar1 is the Text, and strVar1 is the Value. I believe if you
leave strVar2 out, the Value will default to strVar1.
If you need to replace an existing item in a specific index location,
I think you can use: DrpList.Item.Items(ndx).Text = strVar1 DrpList.Item.Items(ndx).Value = strVar2
I'm pretty sure there must be an list item already at the ndx
location, though. George
"San Smith" <Sa********@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl... > I have a dropdown list box with list of item. When I read the data
from > database I want to display that value(one of the item in the drop
down box) > in the dropdown list box. > How to do that in a dropdown list box ? > San > > >
I haven't gotten into db's, yet, so can't help you with that one.
My list items are in an array, and the array index is the same as the list index, so it works out
well.
George
"San Smith" <Sa********@yahoo.com> wrote in message news:uz**************@TK2MSFTNGP12.phx.gbl... If I have several items in the drop down list box(driven by database), is there anyway of identifying a particular items index number. If so.... Then I an set SelectedIndex number. I appriciate your help San.
"George" <------@----.---> wrote in message news:Gx********************@bgtnsc04-news.ops.worldnet.att.net... Dim ndx as integer = 2
DrpList.SelectedIndex = ndx
George
"San Smith" <Sa********@yahoo.com> wrote in message news:uj**************@TK2MSFTNGP10.phx.gbl... George, I already have an index item in the list box.How to set the existing index item to display ? San
"George" <------@----.---> wrote in message news:iU*******************@bgtnsc05-news.ops.worldnet.att.net... > I think you can add an item to your DropDown list by: > > DrpList.Items.Add(New ListItem(strVar1,strVar2)) > > The strVar1 is the Text, and strVar1 is the Value. I believe if you leave strVar2 out, the Value > will default to strVar1. > > If you need to replace an existing item in a specific index location, I think you can use: > > DrpList.Item.Items(ndx).Text = strVar1 > DrpList.Item.Items(ndx).Value = strVar2 > > I'm pretty sure there must be an list item already at the ndx location, though. > > George > > > "San Smith" <Sa********@yahoo.com> wrote in message news:%2****************@TK2MSFTNGP12.phx.gbl... > > I have a dropdown list box with list of item. When I read the data from > > database I want to display that value(one of the item in the drop down box) > > in the dropdown list box. > > How to do that in a dropdown list box ? > > San > > > > > > > >
San, in your code-behind you have an events for the list, such as
SelectedIndexChanged. That gets fired when a user selects a new item
from the list. You can use the event to trap the index of the list item
like this:
Private Sub DropDownList1_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
DropDownList1.SelectedIndexChanged
Dim foo As Integer
DropDownList1.SelectedIndex = foo
End Sub
Of course the list also has a Load event and a DataBinding event where
you could grab the index too (although it may always be zero.)
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
by: Mark |
last post by:
I have two dropdown lists. Both have autopostback set to true. In both
dropdowns, when you select an item from the list, it redirects to the Value
property of the dropdown. Nothing fancy.
...
|
by: Paul |
last post by:
I have a dropdown list box and a button on a web form, the autopost back is
false for the dropdown list box and button. When the button is pushed the
selection in the dropdownlist box is lost,...
|
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...
|
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...
|
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...
|
by: yasodhai |
last post by:
Hi,
I used a dropdown control which is binded to a datagrid control. I
passed the values to the dropdownlist from the database using a
function as follows in the aspx itself.
<asp:DropDownList...
|
by: Andrus |
last post by:
I'm using WinForms DataGridView
I need to make dropdown list wider that grid column width.
I tried the following code, but dropdown list widht is the same as column
width.
How to increase...
|
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...
|
by: abhi3211 |
last post by:
i am using java inside java script page.
in that page i want to use two dropdown list.
in first dropdown list i am getting data from ms-access database.
in second dropdown list i want to get data...
|
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...
|
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...
|
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: 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...
|
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: 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: 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...
|
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: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |