Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Where to add ScriptManager in Global.asax?
Message
From
08/05/2014 11:27:13
 
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
VB 9.0
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01599584
Message ID:
01599735
Views:
41
>>>>>The Global.asax be default has several methods (e.g. Application_Start, Session_Start, and so on). I need to add the ScriptManager call (as shown below) to the Global.asax
>>>>>
>>>>>
>>>>>ScriptManager.ScriptResourceMapping.AddDefinition("jquery", new ScriptResourceDefinition {
>>>>>
>>>>>                Path = "~/scripts/jquery-1.4.1.min.js",
>>>>>
>>>>>                DebugPath = "~/scripts/jquery-1.4.1.js",
>>>>>
>>>>>                CdnPath = "http://ajax.microsoft.com/ajax/jQuery/jquery-1.4.1.min.js",
>>>>>
>>>>>                CdnDebugPath = "http://ajax.microsoft.com/ajax/jQuery/jquery-1.4.1.js"
>>>>>
>>>>>            });
>>>>>
>>>>>
>>>>>In which method of Global.asax.cs the above code should go? TIA
>>>>
>>>>Answer: this code goes to Application_Start method.
>>>
>>>This was a good answer on my PC (running the application from VS 2012). But when I deploy this project on customer site I get the same dreaded message:
>>>
>>>WebForms UnobtrusiveValidationMode requires a ScriptResourceMapping for 'jquery'. Please add a  ScriptResourceMapping named 
>>>jquery(case-sensitive). 
>>>
>>>So apparently my Global.asax.cs is not the right place. Where else do I specify "ScriptManager.ScriptResourceMapping"?
>>
>>Docs say in Application_Start. Where did you put it? And did you reference it in markup ?
>>
>>http://msdn.microsoft.com/en-us/library/system.web.ui.scriptmanager.scriptresourcemapping(v=vs.110).aspx
>
>When you are saying "markup" do you mean this:
>
>
><asp:ScriptManager ID="sm1" runat="server">
>  <Scripts>
>    <asp:ScriptReference Name="jquery"/>
>  </Scripts>
></asp:ScriptManager>
>
>
>If Yes, does the above go to the ASPX page?
>
>Thank you.

I've never used it but, according to the link :
"In the markup for an ASP.NET Web Forms page (.aspx file), add the following markup inside the form element and before any elements or code that uses jQuery script."
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform