Error with JQuery Mobile Error with JQuery Mobile asp.net asp.net

Error with JQuery Mobile


I tested your code and I was able to replicate the error.

First, I think ScriptManager must exist before anything that is using it. Doing this will result in no error:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1.Default" %><html xmlns="http://www.w3.org/1999/xhtml"><head id="Head1" runat="server"><title></title>    <link rel="stylesheet" href="http://ajax.aspnetcdn.com/ajax/jquery.mobile/1.2.0/jquery.mobile-1.2.0.min.css" /></head><body>    <form id="form1" runat="server">        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>    </form>    <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.2.min.js"></script>    <script src="http://ajax.aspnetcdn.com/ajax/jquery.mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script></body></html>

Second, The scripts you are including are the minified or release versions. This is an unconfirmed guess but maybe it is expecting non-minified or debug versions for rendering and they do not exist and putting the ScriptMode="Release" possibly lets it know it should use minified versions. This could be tested by including the minified and debug scripts in the project instead of getting them remotely...... That is how MVC works so that is why I am suggesting that maybe Web Application works the same.

Aside:Following the info at this link here is another way that does not produce any errors:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1.Default" %><!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head id="Head1" runat="server"><title></title>    <link rel="stylesheet" href="http://ajax.aspnetcdn.com/ajax/jquery.mobile/1.2.0/jquery.mobile-1.2.0.min.css" /></head><body>    <form id="form1" runat="server">        <asp:ScriptManager ID="ScriptManager1" runat="server">                <Scripts>                <asp:ScriptReference Path="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.2.min.js"/>                <asp:ScriptReference Path="http://ajax.aspnetcdn.com/ajax/jquery.mobile/1.2.0/jquery.mobile-1.2.0.min.js" />            </Scripts>        </asp:ScriptManager>    </form></body></html>

Edit:

For some reason I also tried setting this in Web.config:

<compilation debug="true" targetFramework="4.0"/>

to this:

<compilation debug="false" targetFramework="4.0"/>

This also works with your original code but, for some reason, I feel like it is a bandaid because it is most likely just hiding the error instead of fixing it.