471,350 Members | 2,016 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,350 software developers and data experts.

SelectionBox + dataset confusion

I have an dataset that populates a selectionbox. I'd like to get the
value of the column "id" of the selected item in the selectionbox
afterwards. How would I do this?
Jun 27 '08 #1
3 1027
"SelectionBox"? I've never heard of such a control. Probably you mean one of
the List derived controls like ListBox or dropdownList, etc. These usually
have a property called SelectedValue which would represent the ID vs.
SelectedText representing what the user "sees" when they make a selectio.
-- Peter
To be a success, arm yourself with the tools you need and learn how to use
them.

Site: http://www.eggheadcafe.com
http://petesbloggerama.blogspot.com
http://ittyurl.net
"sweetiecakes" wrote:
I have an dataset that populates a selectionbox. I'd like to get the
value of the column "id" of the selected item in the selectionbox
afterwards. How would I do this?
Jun 27 '08 #2
Yes, sorry, I accidently confused the name. I mean a ComboBox. But I
want this ID to be consistent with the database one. How would I do this?

Peter Bromberg [C# MVP] wrote:
"SelectionBox"? I've never heard of such a control. Probably you mean one of
the List derived controls like ListBox or dropdownList, etc. These usually
have a property called SelectedValue which would represent the ID vs.
SelectedText representing what the user "sees" when they make a selectio.
-- Peter
To be a success, arm yourself with the tools you need and learn how to use
them.

Site: http://www.eggheadcafe.com
http://petesbloggerama.blogspot.com
http://ittyurl.net
"sweetiecakes" wrote:
>I have an dataset that populates a selectionbox. I'd like to get the
value of the column "id" of the selected item in the selectionbox
afterwards. How would I do this?
Jun 27 '08 #3
If you are databinding the control from a DataSource (DataSet, DataTable,
DataReader) that comes out of the database, you need to set the ValueMember
and the DisplayMember properties of your comboBox to the names of the ID
column and the display text column in your datasource.
-- Peter
To be a success, arm yourself with the tools you need and learn how to use
them.

Site: http://www.eggheadcafe.com
http://petesbloggerama.blogspot.com
http://ittyurl.net
"sweetiecakes" wrote:
Yes, sorry, I accidently confused the name. I mean a ComboBox. But I
want this ID to be consistent with the database one. How would I do this?

Peter Bromberg [C# MVP] wrote:
"SelectionBox"? I've never heard of such a control. Probably you mean one of
the List derived controls like ListBox or dropdownList, etc. These usually
have a property called SelectedValue which would represent the ID vs.
SelectedText representing what the user "sees" when they make a selectio.
-- Peter
To be a success, arm yourself with the tools you need and learn how to use
them.

Site: http://www.eggheadcafe.com
http://petesbloggerama.blogspot.com
http://ittyurl.net
"sweetiecakes" wrote:
I have an dataset that populates a selectionbox. I'd like to get the
value of the column "id" of the selected item in the selectionbox
afterwards. How would I do this?
Jun 27 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

11 posts views Thread by Nikki | last post: by
2 posts views Thread by Steve | last post: by
2 posts views Thread by Rob Richardson | last post: by
22 posts views Thread by Arne | last post: by
reply views Thread by XIAOLAOHU | last post: by

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.