Question

I am using HTML 5 specific markup () in my modified mobile dispform.aspx page (C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\MOBILE\dispform.aspx). In order for some of the browsers to correctly parse and interpret the content, I need to add the

<!DOCTYPE HTML>

as the first line of the response stream. How can I accomplish this?

Was it helpful?

Solution

The parent SPMobilePage has a Response property which can be used to directly inject markup into the response stream.

So in this case in my OnLoad() method is simply find the parent and then add the processing instruction markup:

   protected override void OnLoad(EventArgs e)
   {
        base.OnLoad(e);

        SPMobilePage parent = this.Parent.Parent as SPMobilePage;
        parent.Response.Write("<!DOCTYPE HTML>");
        ...
   }
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top