• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 845
  • Last Modified:

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.
0
tiehaze
Asked:
tiehaze
  • 2
2 Solutions
 
Ashish PatelCommented:
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
 
Ashish PatelCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now