This markup supports code that is not rendered in the mobile version of the page on which I'm working.
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<%@ Register TagPrefix="ComponentArt" Namespace="ComponentArt.Web.UI" Assembly="ComponentArt.Web.UI" %>
<%@ Register Src="Cart.ascx" TagName="Cart" TagPrefix="uc1" %>
<%@ Register Src="Search.ascx" TagName="Search" TagPrefix="uc5" %>
<%@ Register Src="Credits.ascx" TagName="Credits" TagPrefix="uc6" %>
<%@ Register Src="Menu.ascx" TagName="Menu" TagPrefix="uc3" %>
<%@ Register Src="taskspanel.ascx" TagName="TasksPanel" TagPrefix="uc6" %>
Unsurprisingly a lot of unnecessary scripts are loaded. This is bad.
If there is markup to make these registrations conditional please refer me to documentation. Otherwise, my current thought is to use explicit code equivalent to the markup, and make it conditional that way.
I've discovered ScriptManager from this rather old resource but the above markup doesn't reference js files explicitly so I don't know how to map between the two. Can anyone advise?
Attempting to use superjos' response below I modified my page to reference Page.Mobile, a Boolean property conveniently already in place:
<%@ Page Language="C#" AutoEventWireup="false" EnableViewStateMac="false" CodeBehind="Forms.aspx.cs" Inherits="ASSAOHS.forms" %>
<%@ if (!Mobile) { %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<%@ Register TagPrefix="ComponentArt" Namespace="ComponentArt.Web.UI" Assembly="ComponentArt.Web.UI" %>
<%@ Register Src="Cart.ascx" TagName="Cart" TagPrefix="uc1" %>
<%@ Register Src="Search.ascx" TagName="Search" TagPrefix="uc5" %>
<%@ Register Src="Credits.ascx" TagName="Credits" TagPrefix="uc6" %>
<%@ Register Src="Menu.ascx" TagName="Menu" TagPrefix="uc3" %>
<%@ Register Src="taskspanel.ascx" TagName="TasksPanel" TagPrefix="uc6" %>
<%@ } %>
but this produces Parser Error Message: The server block is not well formed.
Writing it like this
<%@ Page Language="C#" AutoEventWireup="false" EnableViewStateMac="false" CodeBehind="Forms.aspx.cs" Inherits="ASSAOHS.forms" %>
@if (!Mobile) {
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<%@ Register TagPrefix="ComponentArt" Namespace="ComponentArt.Web.UI" Assembly="ComponentArt.Web.UI" %>
<%@ Register Src="Cart.ascx" TagName="Cart" TagPrefix="uc1" %>
...
}
doesn't produce an error but isn't processed; the if statement and braces are simply passed through and rendered as text at the browser.
Which leaves me back with option two, map the directives to explicit code using ScriptManager to register stuff. Any takers?
Thanks to Pedro for trying to help but that reference doesn't help with how to express those control directives as code.
It looks like I may need to use option three, which redirect to another page that doesn't contain the directives.