Base solution for your next web application
Open Closed

MVC JQuery Change Tenant Modal not working #5504


User avatar
0
naurinrr created

I am using the latest version v5.6.2, .NET Framework 4.6.1 and ASP.NET CORE MVC & JQuery and downloaded a test project to get started. The change tenant modal is not working, I get the following JS errors,

GetScripts?v=636695095616445017:1150 Uncaught TypeError: Cannot read property 'unspecifiedClockProvider' of undefined
    at GetScripts?v=636695095616445017:1150
    at GetScripts?v=636695095616445017:1152
(anonymous) @ GetScripts?v=636695095616445017:1150
(anonymous) @ GetScripts?v=636695095616445017:1152
common-scripts.js?v=tnZOeg8oRZJYokqP9CKTbKVe8ysLMqiei1dworSquno:119 Uncaught ReferenceError: jQuery is not defined
    at common-scripts.js?v=tnZOeg8oRZJYokqP9CKTbKVe8ysLMqiei1dworSquno:119
(anonymous) @ common-scripts.js?v=tnZOeg8oRZJYokqP9CKTbKVe8ysLMqiei1dworSquno:119
Default.js:3 Uncaught TypeError: app.ModalManager is not a constructor
    at Default.js:3
    at Default.js:15
(anonymous) @ Default.js:3
(anonymous) @ Default.js:15
Login:180 Uncaught ReferenceError: jQuery is not defined
    at Login:180
(anonymous) @ Login:180
3index.html:11 GET https://fonts.googleapis.com/css?family=PT+Mono 0 ()

I have not changed anything except database connection string. I am wondering if anyone came across the same issue before I start debugging in detail.


10 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    Have you executed in the Web.mvc directory: npm run create-bundles command?

    <a class="postlink" href="https://aspnetzero.com/Documents/Getting-Started-Core#run-the-project">https://aspnetzero.com/Documents/Gettin ... he-project</a>

  • User Avatar
    0
    naurinrr created

    Thanks so much! I feel like an idiot of course.

  • User Avatar
    0
    naurinrr created

    Not related to Tenant Modal but still front end issue so asking here, the metronic styles are not loading for selecting an edition. It gives failed to load resource error. I have checked that the styles are present under the path it is looking so I am not sure what is happening.

    <link rel="stylesheet" href="//metronic/dist/html/default/assets/demo/default/base/style.bundle.css?v=I6VCJPzgx8kEu1QQkEPCpevlxGZKqy9bnzUxzUu6apg&amp;v=I6VCJPzgx8kEu1QQkEPCpevlxGZKqy9bnzUxzUu6apg" />

  • User Avatar
    0
    maliming created
    Support Team

    Can you share a screenshot of the output of the chrome console?

  • User Avatar
    0
    naurinrr created

    You can view the image here,

    [https://1drv.ms/u/s!AipZ--KcXtD_smTx0T4v7b6kMv3-])

  • User Avatar
    0
    maliming created
    Support Team

    I see chrome output information: ERR_NAME_NOT_RESOLVED

    You can see what happened to this css request under the chrome control panel Network.

  • User Avatar
    0
    naurinrr created

    You can see the screehshot here [https://1drv.ms/u/s!AipZ--KcXtD_smU7xwpjUg3l3qV0])

    It is getting response "failed" because it is going to a web address. Why is not looking under localhost? The metronic styles are loading correctly for other pages like dashboard and such so what is different about this one?

    <a class="postlink" href="http://metronic/dist/html/default/assets/demo/default/base/style.bundle.css?v=I6VCJPzgx8kEu1QQkEPCpevlxGZKqy9bnzUxzUu6apg&v=I6VCJPzgx8kEu1QQkEPCpevlxGZKqy9bnzUxzUu6apg">http://metronic/dist/html/default/asset ... zUxzUu6apg</a>

  • User Avatar
    0
    maliming created
    Support Team

    <link rel="stylesheet" href="//metronic/dist/html/default/assets/demo/default/base/style.bundle.css?v=I6VCJPzgx8kEu1QQkEPCpevlxGZKqy9bnzUxzUu6apg&amp;v=I6VCJPzgx8kEu1QQkEPCpevlxGZKqy9bnzUxzUu6apg" />

    <link rel="stylesheet" href="/metronic/dist/html/default/assets/demo/default/base/style.bundle.css?v=I6VCJPzgx8kEu1QQkEPCpevlxGZKqy9bnzUxzUu6apg&amp;v=I6VCJPzgx8kEu1QQkEPCpevlxGZKqy9bnzUxzUu6apg" />

    Keep only one left slash: href="/metronic/..."

  • User Avatar
    0
    naurinrr created

    Thanks for the hint! I am just posting the solution here in case anyone needs it. It is the style sheet reference in _Layout.cshtml under TenantRegistration that is the problem.

    <link rel="stylesheet" href="@ApplicationPath/metronic/dist/html/@theme/assets/demo/@theme/base/style.bundle@(CultureHelper.IsRtl ? ".rtl":"").css" asp-append-version="true" />
    

    I fixed it by trimming the slash at the end of

    @ApplicationPath
    

    The final code looks like below,

    <link rel="stylesheet" href="@ApplicationPath.TrimEnd('/')/metronic/dist/html/@theme/assets/demo/@theme/base/style.bundle@(CultureHelper.IsRtl ? ".rtl":"").css" asp-append-version="true" />
    
  • User Avatar
    0
    maliming created
    Support Team

    I guess this is related to: <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/issues/1505">https://github.com/aspnetzero/aspnet-ze ... ssues/1505</a>