1

Here is a .net 4.5 question....

I need unobtrusive validation and noticed that jquery only loads when needed. Since I have a master page that uses jquery, how do I serve it? If I add a script to the bottom of the page, I see too references to Jquery instead of one. Can someone please explain to me how to get around this. Thanks.

global.aspx

I am running the following under Application_Start():

    '----------------------------------------------------
    'Declarations
    '----------------------------------------------------
    '.
    '.
    '.
    Dim Item As New ScriptResourceDefinition

    '----------------------------------------------------
    'Initialize
    '----------------------------------------------------
    '.
    '.
    '.
    With Item

        '------------------------------------------------
        'Path
        '------------------------------------------------
        '.
        '.
        '.
        .Path = "/assets/scripts/jquery-1.7.2.min.js"

        '------------------------------------------------
        'Debug Path
        '------------------------------------------------
        '.
        '.
        '.
        .DebugPath = "/assets/scripts/jquery-1.7.2.min.js"

        '------------------------------------------------
        'CDN Path
        '------------------------------------------------
        '.
        '.
        '.
        .CdnPath = "//ajax.microsoft.com/ajax/jQuery/jquery-1.7.2.min.js"

        '------------------------------------------------
        'CDN Debug Path
        '------------------------------------------------
        '.
        '.
        '.
        .CdnDebugPath = "//ajax.microsoft.com/ajax/jQuery/jquery-1.7.2.min.js"

    End With

    '----------------------------------------------------
    'Register
    '----------------------------------------------------
    '.
    '.
    '.
    ScriptManager.ScriptResourceMapping.AddDefinition("jquery", Item)
Eric Harms
  • 569
  • 5
  • 17

0 Answers0