实现 Telerik 组合框,但它渲染没有列表的简单文本框
以下是我尝试与 Telerik Combobox 挂钩的代码,但它不起作用
@(Html.Telerik().ComboBox().Name("ComboBox").BindTo(ViewBag.GenreId))
GenreId 是在 viewbag 中传递的选择列表。以下是控制器代码
public ActionResult Create()
{
ViewBag.GenreId = new SelectList(db.Genres, "GenreId", "Name");
ViewBag.ArtistId = new SelectList(db.Artists, "ArtistId", "Name");
return View();
}
Following is the code i am trying to hook with Telerik Combobox but it aint working
@(Html.Telerik().ComboBox().Name("ComboBox").BindTo(ViewBag.GenreId))
GenreId is a select list passed in the viewbag. Following is the controller code
public ActionResult Create()
{
ViewBag.GenreId = new SelectList(db.Genres, "GenreId", "Name");
ViewBag.ArtistId = new SelectList(db.Artists, "ArtistId", "Name");
return View();
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在那里看不到您的代码有问题。您是否检查过选择列表实际上已填充?您还检查过是否添加了所有 Telerik 库?尝试使用您在代码中创建的已知选择列表创建组合。
Can't see a problem with your Code there. Have you checked the select list is actually populated? Also have you checked that all your Telerik libraries are added? Try creating a combo with a known selectlist that you created in code.