Hi,
I am using the Prometheus RadComboBox in a custom web control, to display and select place names (with a corresponding place id). In once instance I am using the control on a user profile page to show the user's hometown.
On the custom control I have a public attribute of 'SelectedId' which I use to populate the RadComboBox when the page loads - the id and place name of the user's hometown are turned into a RadComboBoxItemData and is added to the control. This works fine.
My problem when you try use the combobox on the page to change the user's hometown. Using LoadOnDemand, the combox successfully lets you select another place. Debugging client side before posting back the update to the profile, I can confirm that the selected value of the combox is the id of the new place selected.
However, when I postback to the server to try and save the changes, the SelectedId of my custom control always returns the original value, instead of the newly selected value.
In the get section
My _RadGroupBox.SelectedValue always holds onto the original value. The setter is not being hit, so I know that the control is not being repopulated from the database. At the same time, the _RadGroupBox.Text correctly contains the new selected place name. It is just the SelectedValue that is not being passed in.
Hopefully this makes some sense to you. I understand its hard to follow unless you can see the whole project, but hopefully you might be able to offer some advice.
Thanks,
Martin
I am using the Prometheus RadComboBox in a custom web control, to display and select place names (with a corresponding place id). In once instance I am using the control on a user profile page to show the user's hometown.
On the custom control I have a public attribute of 'SelectedId' which I use to populate the RadComboBox when the page loads - the id and place name of the user's hometown are turned into a RadComboBoxItemData and is added to the control. This works fine.
public string SelectedId |
{ |
get |
{ |
int result; |
if( !int.TryParse(_RadGroupBox.SelectedValue, out result)) |
{ |
result = 0; |
} |
return result.ToString(); |
} |
set |
{ |
// Place is just a custom object with a name and id. |
Place place = new Place(Convert.ToInt32(value)); |
place.PlaceId = Convert.ToInt32(value); |
RadComboBoxItemData itemData = new RadComboBoxItemData(); |
itemData.Value = value; |
itemData.Text = GroupFormatter.GetLongDisplayName(place); |
RadComboBoxItem item = new RadComboBoxItem(itemData.Text, itemData.Value); |
item.Selected = true; |
_RadGroupBox.Items.Add(item); |
_RadGroupBox.SelectedIndex = 0; |
} |
} |
My problem when you try use the combobox on the page to change the user's hometown. Using LoadOnDemand, the combox successfully lets you select another place. Debugging client side before posting back the update to the profile, I can confirm that the selected value of the combox is the id of the new place selected.
However, when I postback to the server to try and save the changes, the SelectedId of my custom control always returns the original value, instead of the newly selected value.
In the get section
get |
{ |
int result; |
if( !int.TryParse(_RadGroupBox.SelectedValue, out result)) |
{ |
result = 0; |
} |
return result.ToString(); |
} |
My _RadGroupBox.SelectedValue always holds onto the original value. The setter is not being hit, so I know that the control is not being repopulated from the database. At the same time, the _RadGroupBox.Text correctly contains the new selected place name. It is just the SelectedValue that is not being passed in.
Hopefully this makes some sense to you. I understand its hard to follow unless you can see the whole project, but hopefully you might be able to offer some advice.
Thanks,
Martin