Hello,
I use 'RadControls for ASP.NET AJAX Q1 2011 SP2', Windows7 and IE9, I have a problem on the column width of a radgrid.
When I use the document compatibility mode 'EmulateIE7', the width of the columns's header occupies all the grid instead the width of the data items is the value defined. This is a sample to simulate the problem:
See the attached image:
- wrong.png with the compatibility mode EmulateIE7
- correct.png, without the line:
'<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
Why the strange rendering with EmulateIE7 mode?
I use 'RadControls for ASP.NET AJAX Q1 2011 SP2', Windows7 and IE9, I have a problem on the column width of a radgrid.
When I use the document compatibility mode 'EmulateIE7', the width of the columns's header occupies all the grid instead the width of the data items is the value defined. This is a sample to simulate the problem:
<%@ Page EnableEventValidation="false" Language="C#" AutoEventWireup="true" MaintainScrollPositionOnPostback="true"
CodeBehind="Dome1.aspx.cs" Inherits="WebApplication1.Dome1" %>
<%@ Import Namespace="System.Data" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<
script
runat
=
"server"
>
protected void RadGrid_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
DataTable dt = new DataTable();
DataRow dr;
int colsNum = 12;
int rowsNum = 10;
string colName = "Column";
for (int j = 1; j <= colsNum; j++)
{
dt.Columns.Add(String.Format("{0}{1}", colName, j));
}
for (int i = 1; i <= rowsNum; i++)
{
dr = dt.NewRow();
for (int k = 1; k <= colsNum; k++)
{
dr[String.Format("{0}{1}", colName, k)] = String.Format("{0}{1} Row{2}", colName, k, i);
}
dt.Rows.Add(dr);
}
(sender as RadGrid).DataSource = dt;
}
</
script
>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
head
id
=
"Head1"
runat
=
"server"
>
<%-- Comment the following line to remove the problem --%>
<
meta
http-equiv
=
"X-UA-Compatible"
content
=
"IE=EmulateIE7"
/>
<
meta
http-equiv
=
"content-type"
content
=
"text/html; charset=utf-8"
/>
<
title
>RadGrid problem</
title
>
</
head
>
<
body
>
<
form
id
=
"form1"
runat
=
"server"
>
<
asp:ScriptManager
ID
=
"ScriptManager1"
runat
=
"server"
/>
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
AutoGenerateColumns
=
"False"
OnNeedDataSource
=
"RadGrid_NeedDataSource"
Width
=
"100%"
>
<
MasterTableView
TableLayout
=
"fixed"
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"Column1"
HeaderText
=
"Header 1"
/>
<
telerik:GridBoundColumn
DataField
=
"Column2"
HeaderText
=
"Header 2"
/>
</
Columns
>
</
MasterTableView
>
<
HeaderStyle
Width
=
"200px"
/>
<
ClientSettings
>
<
Scrolling
AllowScroll
=
"true"
UseStaticHeaders
=
"true"
/>
</
ClientSettings
>
</
telerik:RadGrid
>
</
form
>
</
body
>
</
html
>
See the attached image:
- wrong.png with the compatibility mode EmulateIE7
- correct.png, without the line:
'<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
Why the strange rendering with EmulateIE7 mode?