Telerik MVC 组合框自动完成错误
我正在使用 Telerik 自动完成选项
在标头中:
<script type="text/javascript">
function onAutoCompleteDataBinding(e) {
var autocomplete = $('#AutoComplete').data('tAutoComplete');
autocomplete.dataBind(["Product 1", "Product 2", "Product 3"]}
</script>
在视图正文中:
<%=Html.Telerik().AutoComplete()
.Name("AutoComplete")
.ClientEvents(events => events.OnDataBinding("onAutoCompleteDataBinding"))
%>
http:// /demos.telerik.com/aspnet-mvc/combobox/clientsidebinding
我已经成功地在其他应用程序上实现了这一点,而且它确实非常简单。 我已将这个示例粘贴在顶部,以表明该示例也出现了问题:
this.trigger = new $t.list.trigger(this);
认为我可能混淆了 .js 文件,现在我的自动完成功能无法正常工作。 任何 js 文件的建议以及它们必须按什么顺序才能正常工作
我的页面掌握相关部分:
<body>
<% Html.Telerik().ScriptRegistrar()
.DefaultGroup(group => group
.Add("MicrosoftAjax.js")
.Add("MicrosoftMvcAjax.js")
);
%>
<div class="MainTableBody">
<asp:ContentPlaceHolder ID="ContentPlaceHolder" runat="server" />
</div>
<% Html.Telerik().ScriptRegistrar().Render(); %>
</body>
</html>
在我的 web.config 中
<add namespace="Telerik.Web.Mvc.UI" />
任何帮助或评论将不胜感激
I am using the Telerik autocomplete option
In the header:
<script type="text/javascript">
function onAutoCompleteDataBinding(e) {
var autocomplete = $('#AutoComplete').data('tAutoComplete');
autocomplete.dataBind(["Product 1", "Product 2", "Product 3"]}
</script>
In the body of the View:
<%=Html.Telerik().AutoComplete()
.Name("AutoComplete")
.ClientEvents(events => events.OnDataBinding("onAutoCompleteDataBinding"))
%>
http://demos.telerik.com/aspnet-mvc/combobox/clientsidebinding
I have managed to get this working on other applications and it is really quite simple.
I have pasted this example on top to show that this one also bombs out on :
this.trigger = new $t.list.trigger(this);
Think i might have mixed up the .js files and now my auto complete is not working.
Any sugesions which js files and in what order they must be for this to work right
My Page master relevant parts:
<body>
<% Html.Telerik().ScriptRegistrar()
.DefaultGroup(group => group
.Add("MicrosoftAjax.js")
.Add("MicrosoftMvcAjax.js")
);
%>
<div class="MainTableBody">
<asp:ContentPlaceHolder ID="ContentPlaceHolder" runat="server" />
</div>
<% Html.Telerik().ScriptRegistrar().Render(); %>
</body>
</html>
In my web.config
<add namespace="Telerik.Web.Mvc.UI" />
Any help or comments would be greatly appreciated
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
发现问题了,
MVC 3 的小 bug,你需要把所有的命名空间放在 web.config 中,而不是把它们放在 mvc 的视图中。
在我看来是这样的。 master
解决方案是,将其从母版页中取出并将其添加到您的 web.config 中,以便母版页只有:
并且 web.config 有:
Found the problem,
MVC 3 little bug, you need to put all the namespaces in the web.config and not have them on your views in mvc.
Was like this in my view.master
The solution was, take it out of the master page and add it to your web.config so that master page only has:
and web.config has:
我不太确定,但我认为 telerik.list.js 文件未加载。检查是否加载了所需的 javascript 文件。这里是一个帮助主题, 显示每个组件所需的 javascript 文件。您可以使用 ViewSource... 验证加载了哪些文件
浏览器(例如 FF)的方法并查看页面末尾。
I am not exactly sure, but I think that the telerik.list.js file is not loaded. Check if the required javascript files are loaded. Here is a help topic, which shows required javascript files per component. You can verify which files are loaded using ViewSource...
method of the browser (FF for instance) and look at the end of the page.