How to use value member with a databound combobox

I have a combobox that is bound to a table. The display member is the column that has the persons name. The value member is linked to the column that has the persons social security number. I have two questions:

What is the best event to use when dealing with comboboxes. I just want the basic one where when the user selects an item, it will run code from the event.

Lets say I have a variable 'x'. How do I set x to the persons social security number on the event when someone selects a name.
tiehazeAsked:
Who is Participating?
 
Ashish PatelConnect With a Mentor Commented:
You need event for javascript or C# code behind?
If javascript event is required then go to html souce code and in the CheckBox list tag write onChange manually, as this wont appear in the event list. like below

<asp:CheckBoxList ID="CheckBoxList1" runat="server" onChange="CallFunction()">
        </asp:CheckBoxList>

And if you need C# event then just double click on the CheckBox List and SelectedIndexChange event will turn up and you will have to use this.
0
 
Ashish PatelConnect With a Mentor Commented:
onChange Event.

in javascript
var x = document.forms[0].ComboBoxName.value;
0
 
tiehazeAuthor Commented:
I am using visual studio... there is no onChange event for comboboxes.

I am also using c#
0
All Courses

From novice to tech pro — start learning today.