selectindex always = 1 from datacombo

C

chris

I give up. I've got a dropdowncombo. I'm trying to refer to the user
selection in the SelectedIndexChanged event. I select one of the last
items in the list. So far I have not been able to successfully access
either the text or the value using an index.

I've been plowing through deja.com to try and find a clue. The closest
I've gotten was someone mentioning in a September post that it didn't
work and you need to cast something. Sorry. I don't know anything about
fishing. I'm using VB for my code-behind.

Any suggestions including code snippets would be helpful.

My current, non-working code is....

If cmbFirst.Items(cmbFirst.SelectedIndex).Value = True Then
gg = cmbFirst.SelectedIndex
setSub(cmbFirst.Items(cmbFirst.Selectedindex).Text(),
cbSub1)
End If

TIA
 
G

Guest

1) The Selected Value and text is available using
cmbFirst.SelectedItem.Value & cmbFirst.SelectedItem.Text
2) One common mistake is, data binding on every post back. You may want to
make sure whether your data binding code is being called only the first time
page loaded.

code should be like below

if(!Page.IsPostBack())
{
\\code to databind cmbFirst
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top