Gridview显示与IE7,8和IE 9的兼容性 [英] Gridview display compatibilty with IE7,8 and IE 9

查看:123
本文介绍了Gridview显示与IE7,8和IE 9的兼容性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的网页中有1个网格视图.在该行样式中,我使wrap = false.我要在一行中排成一行,否则会扭曲文本.

I have 1 grid view in my web page. In that row style ,i make wrap=false. I want rows in single line.Witout warping the text.

<RowStyle Wrap="false"  />



因此,此代码适用于IE8和IE9.但是IE7无法正常工作.

谁能告诉我如何在IE7中使其可行?

谢谢



So this code is working for IE8 and IE9. But IE7 it is not working.

Can any one tell me how to make this workable in IE7?

Thanks

推荐答案

看看这个线程


尝试在单元格中添加一个nowrap属性...
ASP
Have a look at this thread ASPxGridView - How to no wrap a text[^] particularly the response from "Marion".


Try putting adding a nowrap attribute to the cells themselves ...
ASP
<asp:GridView ID="GridView1" runat="server"

       onrowdatabound="GridView1_RowDataBound">
...
   </asp:GridView>


C#背后的代码


Code behind C#

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
    for (int i = 0; i < e.Row.Cells.Count; i++)
    {
        e.Row.Cells[i].Attributes.Add("style", "white-space: nowrap;");
    }
}


或VB.


or VB.

Protected Sub GridView1_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs)
    For i As Integer = 0 To e.Row.Cells.Count - 1
        e.Row.Cells(i).Attributes.Add("style", "white-space: nowrap;");
    Next
End Sub


这篇关于Gridview显示与IE7,8和IE 9的兼容性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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