DevExpress
(v. 12.2.4.0) for SharePoint 2010 applications.
We need to
set document mode in IE: IE8 standards - Sharepoint don't like IE9 document mode.
This work,
but set highest possible document mode, it
is not good for us.
C#HttpContext.Current.Items ["__DXPageRequiresIE8CompatibilityMode"] = new Object();
DevExpress.Web.ASPxClasses.ASPxWebControl.SetIECompatibilityModeEdge();
DevExpress.Web.ASPxClasses.ASPxWebControl.SetIECompatibilityModeEdge(this.Page);
HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html
xmlns:o="urn:schemas-microsoft-com:office:office"
__expr-val-dir="ltr" lang="pl-pl" dir="ltr">
<head><meta
http-equiv="X-UA-Compatible" content="IE=edge" />
http://www.devexpress.com/DXR.axd?r=1_6,1_7,1_8,1_5,1_1,1_3,1_4,1_2-NE8q6<meta
http-equiv="X-UA-Compatible" content="IE=8" /><meta
name="GENERATOR" content="Microsoft SharePoint"
/><meta name="progid"
content="SharePoint.WebPartPage.Document" /><meta
http-equiv="Content-Type" content="text/html;
charset=utf-8" /><meta http-equiv="Expires"
content="0" /><title>…
Meta tag is first, it’s working.
Second meta tag (“IE=8”) is from master page, IE
ignore this tag.
But code:
C#HttpContext.Current.Items ["__DXPageRequiresIE8CompatibilityMode"] = new Object();
DevExpress.Web.ASPxClasses.ASPxWebControl.SetIECompatibilityMode(8);
DevExpress.Web.ASPxClasses.ASPxWebControl.SetIECompatibilityMode(8, this.Page.Master);
Do nothing!HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html
xmlns:o="urn:schemas-microsoft-com:office:office"
__expr-val-dir="ltr" lang="pl-pl" dir="ltr">
<head>http://www.devexpress.com/DXR.axd?r=1_6,1_7,1_8,1_5,1_1,1_3,1_4,1_2-NE8q6<meta
http-equiv="X-UA-Compatible" content="IE=8" /><meta
name="GENERATOR" content="Microsoft SharePoint"
/><meta name="progid"
content="SharePoint.WebPartPage.Document" /><meta
http-equiv="Content-Type" content="text/html; charset=utf-8"
/><meta http-equiv="Expires" content="0"
/><title>
First tag
is (link rel="stylesheet”), second
is “X-UA-Compatible” – unfortunately IE9 ignore this tag
and set Document mode to IE7 - it destroy SP page layout.
Question:
How to set Document mode to IE8?
How to
insert meta tag “X-UA-Compatible” before “stylesheet”?
Hello Grzegorz,
As far as I know, the <meta http-equiv="X-UA-Compatible" content="IE=8" /> tag is already hard-corded into the SharePoint 2010 page, and there is no need to insert this meta tag manually. It seems that the issue has another nature (e.g., Strict Doctype). Would you please send us a problematic code and screencast that illustrates the problem?
It is not hard-coded, You can edit this, but this is not the point.
The point is this line in <head> section:
link rel="stylesheet" type="text/css" href="/DXR.axd?r=1_6,1_7,1_8,1_5,1_1,1_3,1_4,1_2-NE8q6"
Devexpress controls automatically add the above line to the first line of the <head> section.
Because of this IE9 can’t recognize the correct document mode and switches to IE7 document mode.
That behavior causes our sharepoint pages to render incorrectly.
I want to remove this line OR add it at the end of <head> section
Next line is the first line from master page (in head section):
<meta http-equiv="X-UA-Compatible" content="IE=8" />
IE9 ignore this line, and set document mode: IE7
The goal is:
<head>
<meta http-equiv="X-UA-Compatible" content="IE=8" />
link rel="stylesheet" type="text/css" href="/DXR.axd?r=1_6,1_7,1_8,1_5,1_1,1_3,1_4,1_2-NE8q6"
…
Not this:
<head>
link rel="stylesheet" type="text/css" href="/DXR.axd?r=1_6,1_7,1_8,1_5,1_1,1_3,1_4,1_2-NE8q6"
<meta http-equiv="X-UA-Compatible" content="IE=8" />
…
Grzegorz,
Thank you for your clarification. I am afraid I do not have an immediate answer. We need some time to check and discuss this behavior with our team. We will update this thread as soon as we have any results.
Hello Grzegorz,
We need to clarify some extra information that may help us provide you with an appropriate solution:
>>It is not hard-coded, You can edit this, but this is not the point.
Do you mean that you have administrative access to the SharePoint pages and the corresponding master pages? I.e., you are not just creating portable/WebPart solutions for 3-rd SharePoint-based portals;
>>This work, but set highest possible document mode, it is not good for us.
Would you please clarify the following:
- "where" (in context of each page/module/code file) you are executing this code?
- how you are inserting out controls to the SharePoint environment (directly to pages, though WebParts/VisualWebParts)?
Hello,
We have administrative access to SharePoint farm, so yes, we are able to edit the masterpage. We are creating our web parts programmatically.
We are using ASPxGridViewGrid control in our custom control inside our custom web part.
In control .ascx file we have:
<dx:ASPxGridView ID="grid" runat="server" AutoGenerateColumns="False" Width="100%" GridLines="None" > …</dx:ASPxGridView>
In a WebPart (System.Web.UI.WebControls.WebParts) class we have a following method:
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
//This works but sets he highest IE document mode:
//HttpContext.Current.Items["__DXPageRequiresIE8CompatibilityMode"] = new Object();
//DevExpress.Web.ASPxClasses.ASPxWebControl.SetIECompatibilityModeEdge();
//DevExpress.Web.ASPxClasses.ASPxWebControl.SetIECompatibilityModeEdge(this.Page);
//This doesn’t work – sets IE7 document mode instead of IE8
HttpContext.Current.Items["__DXPageRequiresIE8CompatibilityMode"] = new Object();
DevExpress.Web.ASPxClasses.ASPxWebControl.SetIECompatibilityMode(8);
DevExpress.Web.ASPxClasses.ASPxWebControl.SetIECompatibilityMode(8, this.Page);
}