I am using the Combo Box (latest version of ASP.NET AJAX components) and catching the control when the user selects a new item in the list. I need the Value the user selected, NOT the Text, but the new Text appears to be the only I can capture. When the user selects a new item, my code fires properly and I capture e.text, e.oldtext, e.value, and e.oldvalue. When I do this, the e.text and e.oldtext accurately reflect the results, but the e.value and e.oldvalue are identical -- they are both the OLD value.
I have attached a screen capture that shows the results, plus it also shows the contents of the Text/Value pairs that the combo box was loaded with.
The code for the .aspx file is:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="LanguageSelector.ascx.cs" Inherits="HomesOnlineNetwork100.UserControls.LanguageSelector" %>
<
telerik:RadComboBox
ID
=
"LanguageSelectorComboBox"
runat
=
"server"
AutoPostBack
=
"true"
onselectedindexchanged
=
"LanguageSelectorComboBox_SelectedIndexChanged"
></
telerik:RadComboBox
>
<
br
/>
<
br
/>
<
asp:Label
ID
=
"Label1"
runat
=
"server"
Text
=
"e.Text:"
></
asp:Label
> <
asp:Label
ID
=
"etext"
runat
=
"server"
Text
=
"UserLanguageKey"
></
asp:Label
>
<
br
/>
<
asp:Label
ID
=
"Label2"
runat
=
"server"
Text
=
"e.OldText:"
></
asp:Label
> <
asp:Label
ID
=
"eoldtext"
runat
=
"server"
Text
=
"UserLanguageKey"
></
asp:Label
>
<
br
/>
<
asp:Label
ID
=
"Label3"
runat
=
"server"
Text
=
"e.Value:"
></
asp:Label
> <
asp:Label
ID
=
"evalue"
runat
=
"server"
Text
=
"UserLanguageKey"
></
asp:Label
>
<
br
/>
<
asp:Label
ID
=
"Label4"
runat
=
"server"
Text
=
"e.OldValue:"
></
asp:Label
> <
asp:Label
ID
=
"eoldvalue"
runat
=
"server"
Text
=
"UserLanguageKey"
></
asp:Label
>
<
br
/>
<
br
/>
<
br
/>
<
asp:Label
ID
=
"Label5"
runat
=
"server"
Text
=
"Loaded Text/Values:"
></
asp:Label
>
<
br
/>
<
asp:Label
ID
=
"Label6"
runat
=
"server"
Text
=
""
></
asp:Label
>
The applicable code for the SelectedIndexChanged is:
protected
void
LanguageSelectorComboBox_SelectedIndexChanged(
object
sender, RadComboBoxSelectedIndexChangedEventArgs e)
{
Session[
"a"
] = e.Value;
Session[
"b"
] = e.OldValue;
Session[
"c"
] = e.Text;
Session[
"d"
] = e.OldText;
The applicable code for the Page_Load event is:
protected
void
Page_Load(
object
sender, EventArgs e)
{
this
.evalue.Text = Convert.ToString(Session[
"a"
]);
this
.eoldvalue.Text = Convert.ToString(Session[
"b"
]);
this
.etext.Text = Convert.ToString(Session[
"c"
]);
this
.eoldtext.Text = Convert.ToString(Session[
"d"
]);
}
Can anyone please tell me why this is happening? I need the new VALUE that the user selected because that is the key to the related database record. Why doesn't the new VALUE come through the event?
My thanks in advance!
Lynn