На контроллере Используйте следующий код:
public List<ReceiveType> _data = new List<ReceiveType> {
new ReceiveType{ReceiveTypeID=1,ReceiveTypeName= "Purchase Order"},
new ReceiveType{ReceiveTypeID=2,ReceiveTypeName= "Sales Return"},
new ReceiveType{ReceiveTypeID=3,ReceiveTypeName= "FOC"}
};
public string load_cmbBoxWithServerSideDataFromClient()
{
var _List = new SelectList(_data, "ReceiveTypeID", "ReceiveTypeName");
return new JavaScriptSerializer().Serialize(_List);
}
На странице просмотра используйте следующий код
@(Html.Telerik().ComboBox().Name("cmbLoadServerData"))
<input type="button" value="load" onclick="load_ServerDataFromClient()" /><br />
function load_ServerDataFromClient() {
var cmb = $('#cmbLoadServerData').data('tComboBox');
$.get("/Home/load_cmbBoxWithServerSideDataFromClient", function (response) {
var selectList = $.parseJSON(response);
cmb.dataBind(selectList, true);
});
}