实现 Telerik 组合框,但它渲染没有列表的简单文本框

发布于 2024-12-18 20:52:18 字数 423 浏览 4 评论 0原文

以下是我尝试与 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

〗斷ホ乔殘χμё〖 2024-12-25 20:52:18

在那里看不到您的代码有问题。您是否检查过选择列表实际上已填充?您还检查过是否添加了所有 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文