This question is locked. New answers and comments are not allowed.
This may be by design but I don't recall having this issue with the previous version. Im currently using 2010.3.1318.
I have this code:
You'll notice that im creating the combobox for the StateId property of my viewModel and the list is nothing more than a list of {StateId = 1, StateShort = 'MO'}, etc.
The problem is that as soon as I click on the combobox, a 0 is displayed until I select a value. Yet if I don't select a value or tab out of the field the 0 stays. A 0 is not a valid value in my list for either text or value. This tells me that its grabbing the value of my property StateId, which in this case StateId is 0 as its an int that has not been set.
If I were reloading this page and I wanted the value of stateId to be selected I would assume I would set that value in the select list since there is a paramter to do so:
new SelectList(IEnumerable Items, string dataValueField, string dataTextField, object selectedValue)
So like I said earlier this may be by design. If so do you know of a work around, so that a 0 does not get displayed other than making my property a nullable field?
Thanks,
lmf232s
I have this code:
<%= Html.Telerik().ComboBoxFor(m => m.StateId)
.AutoFill(
true
)
.BindTo(
new
SelectList(ViewData[
"StateList"
]
as
IEnumerable,
"StateId"
,
"StateShort"
))
.Filterable(filtering => filtering.FilterMode(AutoCompleteFilterMode.StartsWith))
.HighlightFirstMatch(
true
)
%>
You'll notice that im creating the combobox for the StateId property of my viewModel and the list is nothing more than a list of {StateId = 1, StateShort = 'MO'}, etc.
The problem is that as soon as I click on the combobox, a 0 is displayed until I select a value. Yet if I don't select a value or tab out of the field the 0 stays. A 0 is not a valid value in my list for either text or value. This tells me that its grabbing the value of my property StateId, which in this case StateId is 0 as its an int that has not been set.
If I were reloading this page and I wanted the value of stateId to be selected I would assume I would set that value in the select list since there is a paramter to do so:
new SelectList(IEnumerable Items, string dataValueField, string dataTextField, object selectedValue)
So like I said earlier this may be by design. If so do you know of a work around, so that a 0 does not get displayed other than making my property a nullable field?
Thanks,
lmf232s