2012-05-10 1 views
0

Telerik MVC 컨트롤 (콤보 상자)을 사용하고 있는데 뷰에서로드 할 때 선택한 값으로 강조 표시하기 위해 모델에서 값을 가져 오는 데 문제가 있습니다.Telerik Combobox가 SelectList의 값에 해당하는 모델의 필드 값을 표시하는 방법은 무엇입니까?

   <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의 값을 페이지가로드 될 때 선택된 항목으로 Combobox에 표시하려고합니다. 그래서 문제는 그것을하는 방법입니다.

답변 됨. 내 모델에서 selectList를 작성하고 해당 위치를 컨트롤에 사용할 때 컨트롤에서 SelectedIndex를 설정할 수있었습니다.

답변

0

내 모델에서 selectList를 작성하고 해당 위치를 컨트롤에 사용했을 때 컨트롤에서 SelectedIndex를 설정할 수있었습니다.