从Controller 传递viewdata 到view 通过下面的代码将传递过来的数据绑定到下拉文本框中,但是预览的时候没有任何数据显示 前端用的是DevExpress ,请大牛帮忙看一下!
@Html.DevExpress().ComboBox(
settings =>
{
settings.Name = "ComBox_MediaType";
settings.Width = Unit.Percentage(100);
settings.Properties.ValueType = typeof(string);
settings.Properties.TextField = "Name";
settings.Properties.ValueField = "ID";
settings.PreRender = (sender, e) =>
{
MVCxComboBox cmb = sender as MVCxComboBox;
cmb.Value =" ";
};
settings.Properties.ClientSideEvents.SelectedIndexChanged = "SelectedMediaType";
}
).BindList(ViewData["MediaTypeList"]).GetHtml()
settings.Name 设置错了,应该和属性名一致才可以绑定数据
你可以去官方文档看一下