MVC3& MVCContrib 网格 - 生成的 Html 在浏览器之间不同
我在 MVCContrib 网格中遇到了一些奇怪的事情。使用 Chrome(或 FireFox),当我转到使用 MVCContrib 网格的某个视图时,我得到了预期的结果(多行数据)。然而,在 IE 的同一页面上,我只得到一行(集合中的第一行)。
当我检查两边生成的 html 时,Chrome 拥有所有行,但 IE 只有一行。
以下是项目中的依赖项列表:Fluent NHibernate、Castle Windsor、MvcContrib、JQuery 1.5.1.、JQuery UI、jquery-address、jquery-multiselect
任何人都可以理解这一点吗?这就是所讨论的观点。
<div id="fileList">
@Html.Grid(Model).Columns(column => {
column.For(x => Html.ActionLink(x.Id.ToString(), "FileDetails", new { id = x.Id })).Named("File ID");
column.For(x => x.Client.Name);
column.For(x => x.Status);
column.For(x => x.ProcessDate);
column.For(x => x.TestMode);
}).Attributes(Style => "text-align: center", @Class => "linkGrid").RowAttributes(data => new MvcContrib.Hash(onclick => String.Format("location.href='{0}';", Url.Action("FileDetails", new { id = data.Item.Id }))))
@Html.AjaxPager(Model, new PagerOptions() { PageIndexParameterName="page", ShowDisabledPagerItems = false, AlwaysShowFirstLastPageNumber=true },
new AjaxOptions() { UpdateTargetId = "fileList" })
</div>
新发现:
有时,当我刷新 IE 中的视图时,网格中会出现乱码。有趣的是乱码发生了变化。有时我会得到一些乱码的 JavaScript,甚至还得到一些关于机器上的一些网络硬件的乱码。当我升级到 IE9 时,我才开始收到乱码(希望这能解决问题)。同样,这只发生在 IE 中,Chrome 和 FireFox 工作得很好。
这是我看到的乱码的一个例子:
“䱾宠釚䕽뾀㘳흷ᛣIntel(R) 82567LM Gigabit Network Connection-QoS Packet Scheduler-0000렭蕄��ᇟ₧돨֘Intel(R) 82567LM Gigabit Network Connection-WFP LightWeight Filter-0000렮蕄��ᇟ₧돨٘“WAN 微型端口(IP)擭Ⲫ몣䑳㞶웞ᑚpWAN 微型端口(网络监视器)-QoS 数据包调度程序-0000葮瀹ᇞᴀ降ᱚ VIntel(R ) 82567LM 千兆网络连接뿊ﯩ橙䅴꺝荣퀏VWAN Miniport (IP)-QoS Packet Scheduler-0000葮瀹ᇞᴀ降ᱚZWAN Miniport (IPv6)-QoS Packet Scheduler-0000葮瀹ᇞᴀ降ᱚ (WAN Miniport (PPPOE)ᩒ逾꿺佉쪹郇ꆖ嚠 "RAS 异步适配器⭾砃䥨䋓㞟縨沨ꨊ:软件环回接口 1葮瀹ᇞ満汤捩 BDell 无线 1397 WLAN 迷你卡G��⋂籶䓇춤䦥篸苊 Dell 无线 1397 WLAN 迷你卡 - 虚拟 WiFi 过滤器驱动程序-0000G렱蕄��ᇟ₧돨֘ vDell 无线 1397 WLAN 迷你卡 - QoS 数据包调度程序 - 0000G렯蕄��ᇟ₧돨֘ Dell 无线 1397 WLAN 迷你卡-本机 WiFi 过滤器驱动程序-0000G쾥แ��ᇟᎅ采풩 zDell 无线 1397 WLAN 迷你卡-WFP LightWeight Filter-0000G렰蕄��ᇟ₧돨֘ NMicrosoft 虚拟 WiFi 微型端口适配器G ⋰ꞑૡ䰌侎ᚊց Microsoft 虚拟 WiFi 微型端口适配器-本机 WiFi 筛选器驱动程序-0000G⋳։⤐ᇠ䚖☀릹 Microsoft 虚拟 WiFi 微型端口适配器-QoS 数据包调度程序-0000G⋴։⤐ᇠ䚖☀릹 Microsoft 虚拟 WiFi 微型端口适配器-WFP LightWeight Filter-0000G⋵⤐ᇠ䚖☀릹 &WAN 微型端口 (SSTP)韗燸䶍肬��瀢 (WAN 微型端口 (IKEv2)覠耣鰚䰨馐羼逪᫃ &WAN 微型端口(L2TP)麫䘦助摆뮟骓 &WAN 微型端口 (PPTP)鴬蝂亱·闿ᣄ㌿ 0Microsoft ISATAP 适配器㳳竹눞䔢꺩뺨ン螅 BTeredo 隧道伪接口횀ꎘ忈䊓咚㨎됥钋6Microsoft ISATAP 适配器 #2ⴼꦡ덁䟩㖷첵崰6Microsoft ISATAP 适配器 #3萖ᅴ൸䲖ẓ��᧶6Microsoft ISATAP 适配器 #4ᝲ⪤蒉䄎꾍ꝟ䫺"
I've come across something odd with the MVCContrib Grid. Using Chrome (or FireFox), when I go to a certain view that uses the MVCContrib Grid, I get the expected results (multiple rows of data). However, on the same exact page in IE, I'm only getting a single row (the first in the set).
When I inspect the generated html on both sides, Chrome has all the rows, but IE only has it's one.
Here is a list of the dependencies in the project: Fluent NHibernate, Castle Windsor, MvcContrib, JQuery 1.5.1., JQuery UI, jquery-address, jquery-multiselect
Can anyone make any sense of this? This is the view in question.
<div id="fileList">
@Html.Grid(Model).Columns(column => {
column.For(x => Html.ActionLink(x.Id.ToString(), "FileDetails", new { id = x.Id })).Named("File ID");
column.For(x => x.Client.Name);
column.For(x => x.Status);
column.For(x => x.ProcessDate);
column.For(x => x.TestMode);
}).Attributes(Style => "text-align: center", @Class => "linkGrid").RowAttributes(data => new MvcContrib.Hash(onclick => String.Format("location.href='{0}';", Url.Action("FileDetails", new { id = data.Item.Id }))))
@Html.AjaxPager(Model, new PagerOptions() { PageIndexParameterName="page", ShowDisabledPagerItems = false, AlwaysShowFirstLastPageNumber=true },
new AjaxOptions() { UpdateTargetId = "fileList" })
</div>
New Find:
Sometimes, when I refresh the view in IE, I get Giberish back in the grid. What was interesting is that the giberish changes. Sometimes I'll get bits and pieces of garbled javascript, and I even got some giberish about some of the networking hardware on the machine. I only started getting the giberish when I upgraded to IE9 (hoping that would fix the problem). Again this only happens in IE, Chrome and FireFox work perfectly.
This is an example of the giberish I see:
"䱾寵釚䕽뾀㘳흷ᛣIntel(R) 82567LM Gigabit Network Connection-QoS Packet Scheduler-0000렭蕄��ᇟ₧돨ӘIntel(R) 82567LM Gigabit Network Connection-WFP LightWeight Filter-0000렮蕄��ᇟ₧돨Ә "WAN Miniport (IP)擭Ⲫ몣䑳㞶웞ᑚpWAN Miniport (Network Monitor)-QoS Packet Scheduler-0000葮瀹ᇞᴀ降ᱚ VIntel(R) 82567LM Gigabit Network Connection뿊ﯩ橙䅴꺝榮퀏蜒VWAN Miniport (IP)-QoS Packet Scheduler-0000葮瀹ᇞᴀ降ᱚZWAN Miniport (IPv6)-QoS Packet Scheduler-0000葮瀹ᇞᴀ降ᱚ(WAN Miniport (PPPOE)ᩒ踰꿺佉쪹郇ꆖ嚠 "RAS Async Adapter⭾砃䥨䋓㞟縨沨ꨊ:Software Loopback Interface 1葮瀹ᇞ満湯捩 BDell Wireless 1397 WLAN Mini-CardG��⋂籶䓇춤䦥篸苊 Dell Wireless 1397 WLAN Mini-Card-Virtual WiFi Filter Driver-0000G렱蕄��ᇟ₧돨Ә vDell Wireless 1397 WLAN Mini-Card-QoS Packet Scheduler-0000G렯蕄��ᇟ₧돨Ә Dell Wireless 1397 WLAN Mini-Card-Native WiFi Filter Driver-0000G쾥แ��ᇟᎅ採풩 zDell Wireless 1397 WLAN Mini-Card-WFP LightWeight Filter-0000G렰蕄��ᇟ₧돨Ә NMicrosoft Virtual WiFi Miniport AdapterG⋰ꞑૡ䰌侎ᚊց Microsoft Virtual WiFi Miniport Adapter-Native WiFi Filter Driver-0000G⋳Ӊ⤐ᇠ䚖☀릹 Microsoft Virtual WiFi Miniport Adapter-QoS Packet Scheduler-0000G⋴Ӊ⤐ᇠ䚖☀릹 Microsoft Virtual WiFi Miniport Adapter-WFP LightWeight Filter-0000G⋵Ӊ⤐ᇠ䚖☀릹 &WAN Miniport (SSTP)韗燸䶍��肬��瀢 (WAN Miniport (IKEv2)覠耣鰚䰨馐羼逪᫃ &WAN Miniport (L2TP)麫䘦助摆뮟骓 &WAN Miniport (PPTP)鴬��蝂亱·闓ᣄ㌿ 0Microsoft ISATAP Adapter㳳竹눞䔢꺩뺨ン螅 BTeredo Tunneling Pseudo-Interface횀ꎘ忈䊓咚㨎됥釙6Microsoft ISATAP Adapter #2ⴼꦡ덁䟩㖷첵崰6Microsoft ISATAP Adapter #3萖ᅴ൸䲖ẓ��᧶6Microsoft ISATAP Adapter #4ᝲ⪤蒉䄎꾍ꝟ䫺"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
经过一次良好的调试会话后,我们在注释部分进行了调试,看来问题是由模型上的
Status
列引起的,该列的类型为char
,并且当值为 0。因此一种可能的解决方案是检查该列的值是否为 0 并替换为空白。After a nice debugging session we had in the comments section it seems that the problem is caused by the
Status
column on the model which is of typechar
and the problem appear when the value is 0. So one possible solution is to check if the value of the column is 0 and replace with an empty space instead.