简体   繁体   English

jQuery Mobile / Telerik全球化错误

[英]Jquery Mobile / Telerik Globalization Error

I have an Asp.net MVC 3 project using Telerik MVC and JqueryMobile. 我有一个使用Telerik MVC和JqueryMobile的Asp.net MVC 3项目。 To enable Globalization to work properly for items such as the MVC Grid I enable Globalization using the following in the master layout page: 为了使全球化对于诸如MVC网格之类的项目正常工作,我在主布局页面中使用以下命令启用了全球化:

@(Html.Telerik().ScriptRegistrar().Globalization(true).DefaultGroup(group => group.Combined(true).Compress(true))) @(Html.Telerik()。ScriptRegistrar()。Globalization(true).DefaultGroup(group => group.Combined(true).Compress(true)))

This works fine if I call my page with the MVC Grid directly eg mycontroller/GridPage , but if I then try to call the same action via JqueryMobile dialog I get the following message: 如果我直接通过MVC Grid调用页面,例如mycontroller / GridPage,则此方法很好,但是如果我随后尝试通过JqueryMobile对话框调用相同的操作,则会收到以下消息:

0x800a01b6 - JavaScript runtime error: Object doesn't support property or method 'load' 0x800a01b6-JavaScript运行时错误:对象不支持属性或方法“加载”

The link I use to call via JqueryMobile is: 我用来通过JqueryMobile调用的链接是:

@Html.ActionLink("My Grid", "GridPage ", "mycontroller", new { data_rel = "dialog", data_theme = "b", data_transition = "flip" })

Removing the Globalization attribute stops the error, but also stops the Globalization 删除“全球化”属性将停止错误,但也会停止全球化

Can anybody advise how I can get past this error? 有人可以建议我如何克服这个错误吗?

Thanks 谢谢

Mark 标记

Alright, I figured out a work around, although I do not really like it. 好吧,尽管我不太喜欢它,但我想出了一个解决方法。 I think when we dynamically add HTML to the DOM like this, it wipes out the jQuery.telerik object, leaving behind only CultureInfo. 我认为,当我们像这样向DOM动态添加HTML时,它会消除jQuery.telerik对象,仅留下CultureInfo。 To get around this, you need to "register" all the telerik controls in the dynamic HTML with/when the original page that was loaded. 要解决此问题,您需要在加载原始页面时/在动态HTML中“注册”所有telerik控件。

For example, if you have a popup with 2 textboxes named txtPrice and txtQuantity, then in any page that can display this popup, you need to declare 2 telerik controls named txtPrice and txtQuantity. 例如,如果您有一个带有2个名为txtPrice和txtQuantity的文本框的弹出窗口,则在任何可以显示此弹出窗口的页面中,您需要声明2个名为txtPrice和txtQuantity的telerik控件。 After being declared, you can remove them from the DOM. 声明后,可以将它们从DOM中删除。 When the popup gets added to the DOM, it will see that controls with that name were already defined and everything will work like normal. 当弹出窗口添加到DOM时,它将看到已经定义了具有该名称的控件,并且一切将正常运行。 It is really a strange error to get considering that everything works fine when Globalization is turned off. 考虑到关闭全球化后一切正常,这确实是一个奇怪的错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM