G
Guest
I have C# ASP.NET VS 2005 combo box set to perform an auto post back when
the user changes the index
protected void dropSSNEdit_SelectedIndexChanged(object sender, EventArgs
e)
{
txtSSN.Text = dropSSN.SelectedItem.ToString();
}
The dropdown control contains SSNs for the ITEMS attribute, the VALUES for
these items are the database IDs that point to that specific record. This way
if the user changes the SSN, it uses the ID in the VALUE attribute to know
what record in SQL to go update.
As you can see, I want to set a text box to the SelectedItem (TEXT) that the
user choose. The problem is that according to the MS Intellisense
..SelectedItem "Gets the selected item with the LOWEST index in the control.
No matter what SSN I select from the dropdown, the textbox is always set to
the first item in the list. This is not what I want. I want the textbox set
to the item of the CURRENT select index, not the LOWEST index
Again I can’t use .SelectedValue b/c it contains the SQL record ID and not
the value the user is supposed to edit.
But if you read MSDN for Frame work 2.0 it says: "Gets or sets currently
selected item in the ComboBox". Which is what I want.
Someone please help. I cant see a way in C# where I could say
dropSSN.SelectedIndex(dropSSN.SelectItem). I know I cant be the only one
that’s noticed this issue. If SelectedItem always gets the LOWEST then there
is no difference between that and saying dropSSN.SelectedIndex = 0.
the user changes the index
protected void dropSSNEdit_SelectedIndexChanged(object sender, EventArgs
e)
{
txtSSN.Text = dropSSN.SelectedItem.ToString();
}
The dropdown control contains SSNs for the ITEMS attribute, the VALUES for
these items are the database IDs that point to that specific record. This way
if the user changes the SSN, it uses the ID in the VALUE attribute to know
what record in SQL to go update.
As you can see, I want to set a text box to the SelectedItem (TEXT) that the
user choose. The problem is that according to the MS Intellisense
..SelectedItem "Gets the selected item with the LOWEST index in the control.
No matter what SSN I select from the dropdown, the textbox is always set to
the first item in the list. This is not what I want. I want the textbox set
to the item of the CURRENT select index, not the LOWEST index
Again I can’t use .SelectedValue b/c it contains the SQL record ID and not
the value the user is supposed to edit.
But if you read MSDN for Frame work 2.0 it says: "Gets or sets currently
selected item in the ComboBox". Which is what I want.
Someone please help. I cant see a way in C# where I could say
dropSSN.SelectedIndex(dropSSN.SelectItem). I know I cant be the only one
that’s noticed this issue. If SelectedItem always gets the LOWEST then there
is no difference between that and saying dropSSN.SelectedIndex = 0.