我使用的是Telerik MVC控件(combobox),在加载视图时,我无法从模型中获取要突出显示的值。
<tr>
<td class="editor-label">
@Html.LabelFor(model => model.CategoryDescription)
</td>
<td class="editor-field">
@Html.DisplayFor(model => model.CategoryDescription)
</td>
<td>
@(Html.Telerik().ComboBoxFor(model => model.CategoryDescription)
.BindTo((SelectList)(Model.CategoryDescriptionList))//(SelectList)(ViewBag.CategoriesList))
.HtmlAttributes(new { style = "width:350px; white-space:nowrap;" })
.HighlightFirstMatch(true)
.Filterable(filtering => filtering.FilterMode(AutoCompleteFilterMode.Contains))
.ClientEvents(events => events.OnClose("ComboBox_OnClose"))
)
@Html.ValidationMessageFor(model => model.CategoryDescription)
</td>
</tr>当页面加载时,我希望Model.CategoryDescription中的值在组合框中显示为选定的条目。所以问题是如何做到这一点。
接听了。当我在模型中构建SelectedIndex并将其位置用于控件时,我能够在控件上设置selectList。
发布于 2012-05-11 22:56:42
当我在模型中构建SelectedIndex并将其位置用于控件时,我能够在控件上设置selectList。
https://stackoverflow.com/questions/10538770
复制相似问题