NateDizzle
asked on
Problem with DropDown / ComboBox selecteditem.text return - list is databound
My problem is:
I have databound a dropdown list to an Access databasem the list is populated with the correct values everytime but when I click the submit button and try to get the selectedItem.Text value from that dropdown list the item always defaults to the first item (rather than the one that was actually selected). This doesn't happen to non-databound dropdown lists and is really a frustratingly simple problem.
Here's the code upon a page refresh/load:
cnBATT.ConnectionString = System.Configuration.Confi gurationSe ttings.App Settings(" connection String")
DsCountries1.Clear()
adptCountries.Fill(DsCount ries1)
Me.basedIn.DataBind()
Me.hqIn.DataBind()
the data members and such have been set in the properties windowm and seem to work since it is populated properly.
When try to get the item text I use:
text1.Text = Me.basedIn.SelectedItem.Te xt
extremely frustrated, Nate-Dizzle
I have databound a dropdown list to an Access databasem the list is populated with the correct values everytime but when I click the submit button and try to get the selectedItem.Text value from that dropdown list the item always defaults to the first item (rather than the one that was actually selected). This doesn't happen to non-databound dropdown lists and is really a frustratingly simple problem.
Here's the code upon a page refresh/load:
cnBATT.ConnectionString = System.Configuration.Confi
DsCountries1.Clear()
adptCountries.Fill(DsCount
Me.basedIn.DataBind()
Me.hqIn.DataBind()
the data members and such have been set in the properties windowm and seem to work since it is populated properly.
When try to get the item text I use:
text1.Text = Me.basedIn.SelectedItem.Te
extremely frustrated, Nate-Dizzle
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
So, I know that the problem is with the page refresh, the selected data is lost during the refresh....not impressed. Have good method to work around this?
ASKER
- it has to be automatic and the first thing the user will click on is the drop down list....I'm going to try a session variable, I really think this is stupid.
ASKER
wow I didn't even see the comment added by tusharashah while I wrote all that garble...I'll give it a try, thanks.
ASKER
Wicked thanks!!
Nice to have you going NateDizle :)
-tushar
-tushar
-tushar