I have experienced lots of problems with the RadCombobox control with trying to bind it while having Enableloadondemand set to true
I'm currently binding on my gridview OnDataBound event by creating a single item and inserting it at index 0.
Now when i need to change te selected Item the enableloadondemand fires correctly and loads items filtered on the text typed in the text area.
after selecting an item the OnSelectedIndexchanged event fires and the radcombobox text is updated to the text of the selected item.
however the Value never gets updated and I will have to perform another query to my recordset to select the value.
Since the text gets updated normally when selecting a different item how come the value doesn't ?
i have a snippet with how i handle the selectedindexchanged event.
Is this the correct behavior ?
I would think that if you can send the correct new text , the new value should be simple too.
I'm currently binding on my gridview OnDataBound event by creating a single item and inserting it at index 0.
Now when i need to change te selected Item the enableloadondemand fires correctly and loads items filtered on the text typed in the text area.
after selecting an item the OnSelectedIndexchanged event fires and the radcombobox text is updated to the text of the selected item.
however the Value never gets updated and I will have to perform another query to my recordset to select the value.
Since the text gets updated normally when selecting a different item how come the value doesn't ?
i have a snippet with how i handle the selectedindexchanged event.
protected
void
RCB1_Selectedindexchanged(
object
sender, RadComboBoxSelectedIndexChangedEventArgs e)
{
RadComboBox rcb = (RadComboBox)sender;
// combobox that fires event
string
hi = rcb.SelectedValue;
// combobox value, always old value
string
ha = rcb.Text;
// combobox text, always text from newly selected item
string
hu = e.OldValue;
// working correctly always value of previously selected item
string
ho = e.OldText;
//working correctly always text of previously selected item
string
he = e.Value;
// not working as one would expect it to work, always OLD value
string
hy = e.Text;
// working as expected always NEW text
string
hiy = rcb.SelectedItem.Value;
// Always old value
string
hyi = rcb.SelectedItem.Text;
// always old value
DataView dv = (DataView)SqlDataSource2.Select(
new
DataSourceSelectArguments());
string
huu;
// correct value after looping through intire datasource, would like to avoid this
foreach
(DataRowView row
in
dv)
{
if
(row[
"Naambedrtot"
].ToString() == rcb.Text)
{
huu = row[
"klantnummer"
].ToString();
}
}
if
(e.OldValue != e.Value)
// always the same so selected value never gets changed
{
rcb.SelectedValue = e.Value;
}
}
Is this the correct behavior ?
I would think that if you can send the correct new text , the new value should be simple too.