空格(或空格)在ajax中的单元格之间显示的抓取数据仅馈送到ie9浏览器中的表, [英] Empty space(or white space) shown in between cells in ajax fetched data fed to table in ie9 browser only,

查看:144
本文介绍了空格(或空格)在ajax中的单元格之间显示的抓取数据仅馈送到ie9浏览器中的表,的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如标题所示,我有一个从数据库加载的表。首先只读取15行。后来有办法让它显示15,50和100记录显示使用下拉列表。其中通过ajax获取。一些如何如果我使获取记录计数超过59或更高,在随机行的单元格之间创建空白空间。它只发生在ie9浏览器。 IE浏览器版本< 9都不错,FF,Chrome,Safari都不错。这是我的第一个问题,所以我不允许张贴图像,所以我会在下面放一些数字形式。



| ..1 .. || ..2 .. || ... 3 ... || .... 4 .... || .5。|| ..6 .. || ..7 .. |



让我们假设上面的是一行,该条作为右边和左边的边界。我在ie9中获取ajax获取的数据是类似下面的



| ..1 .. || ..2 .. || ... 3 ... | | .... 4 .... || .5。|| .6 .. || ..7 .. |



|。 。| _ _ _ | ..2 .. || ... 3 ... || .... 4 .... || .5。|| .6 .. || ..7 .. |



| ..1 .. || .2 .. || ... 3 ... || .... 4 .... | | .5。|| ..6 .. || ..7 .. |



| ..1 .. || ..2 .. ||。 ..3 ... | _ _ _ _ | | 4 .... || .5。|| .6 .. || ..7 .. |



| ..1 .. || ..2 .. || ... 3 ... || .... 4 .... || .5。|| .6。 。|| ..7 .. |



您会看到第二列(第一列后)和第四列(第三列后)的空格)行。我没有得到任何想法,因为IE开发/调试器工具栏没有帮助太多。效果不是随机的,因为我在刷新单元之间或清除缓存之后获得相同的空白空间。可能是由于ajax获取的数据有sth与ie9渲染呢?任何人面临任何这样的问题或关闭一个。任何帮助将不胜感激。谢谢。

解决方案

dhiraj - 似乎没有任何官方声明关于这个从IE的IE9错误,不止一次。它似乎与表行和源代码中的单元格之间的空格相关,并且只发生在UpdatePanels中在ajax回发后呈现的表上。我找到了一个(难看的)问题的修复。



如果使用ListView控件,您将能够删除表结构中的空格。不幸的是,它使你的源代码更不可读,但它似乎解决了这个问题。例如,如果你的原始代码看起来像这样:

 < asp:ListView ID =ListView1runat =服务器> 
< LayoutTemplate>
< table>
< asp:PlaceHolder ID =itemPlaceholderrunat =server>< / asp:PlaceHolder>
< / table>
< / LayoutTemplate>
< ItemTemplate>
< tr>
< td><%#Eval(field1)%>< / td>
< td><%#Eval(field2)%>< / td>
< td><%#Eval(field3)%>< / td>
< td><%#Eval(field4)%>< / td>
< / tr>
< / ItemTemplate>



需要如下:

 < asp:ListView ID =ListView1runat =server> 
< LayoutTemplate>
< table>< asp:PlaceHolder ID =itemPlaceholderrunat =server>< / asp:PlaceHolder>< / table&
< / LayoutTemplate>
< ItemTemplate>
< tr>< td><%#Eval(field1)%>< / td>< td><%#Eval(field2)%> td>< td><%#Eval(field3)%>< / td>< td><%#Eval(field4)%>< / td>< / tr> ;
< / ItemTemplate>



p>

As the title suggest, I have a table which is loaded from database. First only 15 rows are fetched. Later there is way to make it show 15 , 50 and 100 records to show using dropdown list. Which is fetched via ajax. Some how if i make the fetch record count more than 59 or above , empty space is created in between cell at random row. It happens only in ie9 browsers. IE Browsers version< 9 are good, FF, Chrome, Safari are good as well. This is my first question so i'm not allowed to post image, so i'll put some numeric forms below.

|..1..||..2..||...3...||....4....||.5.||..6..||..7..|

Let's assume the above is a row,the bar acting as border right and left. What i get in ie9 ajax fetched data is something like below

|..1..||..2..||...3...||....4....||.5.||..6..||..7..|

|..1..|_ _ _|..2..||...3...||....4....||.5.||..6..||..7..|

|..1..||..2..||...3...||....4....||.5.||..6..||..7..|

|..1..||..2..||...3...|_ _ _ _|....4....||.5.||..6..||..7..|

|..1..||..2..||...3...||....4....||.5.||..6..||..7..|

you see the space (represented by _ 'underscore') in the 2nd ( after 1st column)and 4th (after 3rd column) row. I am not getting any idea, as the IE developer/debugger toolbar isn't helping much. The effect is not random as i get the same empty space between cell on refresh or after clear cache. Might it be due to ajax fetched data has sth to do with ie9 rendering it? Did anyone face any such problem or a close one. Any help would be appreciated. Thank you.

解决方案

dhiraj - There does not seem to be any official statement about this IE9 bug from MS but I have experienced it on more than one occasion. It seems to be related to the whitespace between table rows and cells in the source code and only happens on tables that are rendered in UpdatePanels after an ajax postback. I have found an (ugly) fix for the problem.

If you use a ListView control, you will have the ability to remove the whitespace in your table structure. Unfortunately it makes your source code more unreadable, but it does seem to fix the problem. So, for example, if your original code looked like this:

<asp:ListView ID="ListView1" runat="server">
<LayoutTemplate>
    <table>
        <asp:PlaceHolder ID="itemPlaceholder" runat="server"></asp:PlaceHolder>
    </table>
</LayoutTemplate>
<ItemTemplate>
    <tr>
        <td><%# Eval("field1") %></td>
        <td><%# Eval("field2") %></td>
        <td><%# Eval("field3") %></td>
        <td><%# Eval("field4") %></td>
    </tr>
</ItemTemplate>

Your "fixed" code would need to look like this:

<asp:ListView ID="ListView1" runat="server">
<LayoutTemplate>
    <table><asp:PlaceHolder ID="itemPlaceholder" runat="server"></asp:PlaceHolder></table>
</LayoutTemplate>
<ItemTemplate>
    <tr><td><%# Eval("field1") %></td><td><%# Eval("field2") %></td><td><%# Eval("field3") %></td><td><%# Eval("field4") %></td></tr>
</ItemTemplate>

Hope this helps!

这篇关于空格(或空格)在ajax中的单元格之间显示的抓取数据仅馈送到ie9浏览器中的表,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆