Hi,
I'm using a RadComboBox which, via a DataSource, is populated with a list of monetary values, i.e. 50, 100, 1,000, 2,000. We need to sort the list from low to high, but because the 'value' of each option is not the same as the text, we need to sort it by text, however, the list is being sorted as strings, rather than as numbers, so anything beginning with a '1' is listed before anything beginning with a '2', i.e. 100, 1,000, 2,000, 50 etc. Is there are way to resolve this so that the text is treated as numeric? We are unable to alter the DataSource.
Here is my code:
.ASCX:
<telerik:RadComboBox runat="server" ID="cbMoney" AutoPostBack="false" width="200px" DataSourceID="MoneyDataSource" DataTextField="Descr" DataValueField="CodeValue" Sort="Ascending"></telerik:RadComboBox>
.ASCX.VB:
Protected Sub cbMoney _DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles cbMoney.DataBound
cbMoney.Items.Sort()
End Sub
Thanks in advance,
Hugh
I'm using a RadComboBox which, via a DataSource, is populated with a list of monetary values, i.e. 50, 100, 1,000, 2,000. We need to sort the list from low to high, but because the 'value' of each option is not the same as the text, we need to sort it by text, however, the list is being sorted as strings, rather than as numbers, so anything beginning with a '1' is listed before anything beginning with a '2', i.e. 100, 1,000, 2,000, 50 etc. Is there are way to resolve this so that the text is treated as numeric? We are unable to alter the DataSource.
Here is my code:
.ASCX:
<telerik:RadComboBox runat="server" ID="cbMoney" AutoPostBack="false" width="200px" DataSourceID="MoneyDataSource" DataTextField="Descr" DataValueField="CodeValue" Sort="Ascending"></telerik:RadComboBox>
.ASCX.VB:
Protected Sub cbMoney _DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles cbMoney.DataBound
cbMoney.Items.Sort()
End Sub
Thanks in advance,
Hugh