Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
What is wrong with ScriptManager?
Message
 
 
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
VB 9.0
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01611127
Message ID:
01611152
Vues:
37
>Hi,
>
>I have been having a problem with my ASP.NET web forms page unobtrusive validation NOT working on customer site. Works, however, for me in my VS 2012. Aside from the fact that validation does not work (that is, the requiredfield validation is ignored and empty fields do not stop from submitting the form) another manifestation is the following. When I run the page in IE 11 Developer Tools (DT) -> Network, ScriptResource.axd is NOT loading. That is, in the DT there are 3 lines with ScriptResource.axd?d..... that have Method GET but Result 404 (meaning not loaded, for whatever reasons).
>
>I found what is causing the problem on the customer site. The ASP.NET page has the following section:
>
>
>           <asp:ScriptManager ID="sm1" runat="server">
>                <Scripts>
>                    <asp:ScriptReference Name="jquery"/>
>                </Scripts>
>            </asp:ScriptManager>
>
>
>When I remove/delete the above section from the .aspx file the Validation works and the IE11 Developer Tools does not have the lines ScriptResource.axd.
>
>My question is, can you think of why removing the above section resolves the problem on customer site? What - if any - negative effects could be if I permanently remove this section?
>
>TIA.

After reading the following page http://msdn.microsoft.com/en-us/library/system.web.ui.scriptreference(v=vs.110).aspx I understand ScriptReference better but still very confusing (of course this technology is created by MS so it has to be confusing :). Here is the point of my confusion.

When I create an ASP.NET web forms project in VS 2012, the Mater.Site is prefilled with ScriptManager that references (among others) the following script:
<asp:ScriptReference Name="WebUIValidation.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebUIValidation.js" />
This (above) script reference has both the Path and the Assembly attributes. Yet, the Remarks section of the page (URL above) says the following:
You can include a JavaScript file on an ASP.NET Web page by registering it through a ScriptReference object. 
You can register a script file that is located as a .js file (a static script file) on the Web site. 
You can also register a script file that is embedded as a resource in an assembly. After registering 
the script file, you can use its functions in client script on the Web page.

To register a static script file, set the Path property of the ScriptReference object to the relative location of the file. 

To register a script file that is embedded as a resource in an assembly, set the Assembly property 
to the name of the assembly that contains the file. Then set the Name property to the name of the .js file 
that is embedded in the assembly. In that case, the script file must be embedded, not linked.
So how come VS 2012 references JS file with both Assembly and the Path? Where should the page get the resource at run-time? from Assembly or from the .js in the Path?
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform