West Wind Toolkit for .NET
modalDialog is not a function
Gravatar is a globally recognized avatar based on your email address. modalDialog is not a function
  Craig Tucker
  All
  May 22, 2020 @ 06:14am

Hi Rick, Can you tell me why I am receiving "modalDialog is not a function"?
Thanks, Craig

I am trying to get a simple test working first from an example before I customize. Something like this

function GenericButtonClick(item, name, e) {
                $.modalDialog("This dialog is generic, was created on the fly and requires no page elements. " + name,
            "Generic Modal Dialog ",
            ["OK", "Cancel", "Otherwise"],
            function () {
                var div = $("#divGenericButtonResult");
                var txt = $(this).val();
                if (txt == null)
                    return false; // don't exit

                div.text("You clicked on: " + txt).show();

                return true; // 
            }, false);
    }
Gravatar is a globally recognized avatar based on your email address. re: modalDialog is not a function
  Rick Strahl
  Craig Tucker
  May 22, 2020 @ 12:29pm

Make sure ww.jquery.js is loaded...

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: modalDialog is not a function
  Craig Tucker
  Rick Strahl
  May 22, 2020 @ 12:43pm

Yes, I know the method is in that js file, but am not sure why it isn't being picked up.
Does it have to be in a certain location or are there other associated js files that I'm missing? (I've tried both min and <script src="scripts/ww.jquery.js"></script>

Thank you, Craig

Gravatar is a globally recognized avatar based on your email address. re: modalDialog is not a function
  Rick Strahl
  Craig Tucker
  May 22, 2020 @ 01:41pm

Look in your JavaScript dev tools for errors. Pretty sure that path you have is not going to work - it needs to be a site relative path.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: modalDialog is not a function
  Craig Tucker
  Rick Strahl
  May 23, 2020 @ 05:21am

I can see in dev javascript tools the library path is resolved, however I'm still getting same error. Can you think of anything else to try? Thanks

Gravatar is a globally recognized avatar based on your email address. re: modalDialog is not a function
  Rick Strahl
  Craig Tucker
  May 24, 2020 @ 12:15am

Craig,

I don't know. The function should definitely be there. It's in ww.jquery.js. Maybe check and see if it's there and make sure that the library you're looking at is what's actually getting loaded.

I haven't looked at this stuff in years so other than a quick glance at the code where I see that $.modalDialog() definitely exists. You might also want to make sure that jquery is loaded and the $ is in scope. It should be...

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: modalDialog is not a function
  Craig Tucker
  Rick Strahl
  Jun 3, 2020 @ 10:50am

Hi Rick, I did get this working by loading up higher in the master page. I am now having issues with JS methods not firing. Thanks, Craig

Gravatar is a globally recognized avatar based on your email address. re: modalDialog is not a function
  Craig Tucker
  Craig Tucker
  Jun 5, 2020 @ 06:04am

I was able to finally get my JS scripts to start firing correctly by adding this to them. I have not had to to this in the past because they must have been in scope, however this brought all JS scripts back to life after form postback. Good to go now! Thanks, Craig

function pageLoad(sender, args) {
    $(document).ready(function () {


Gravatar is a globally recognized avatar based on your email address. re: modalDialog is not a function
  Rick Strahl
  Craig Tucker
  Jun 5, 2020 @ 10:57am

Yes scripts need to fire after all the content has loaded. So either you have the scripts at the bottom (after all the rest of the content) or you have it at the top and any code that needs to access scripts on page load needs to use $.ready() or the like.

I guess this happened because the scripts got moved in your previous cleanup.

BTW, this is one of the reasons WebForms and these controls are now deprecated - it's very difficult to figure out where things are going as the framework injects some of the scripts. There are overrides for all of this stuff but it's not really obvious and there are many combinations. The better approach IMHO is to use the JavaScript components directly in script code and not use the server side controls that render them and provide a small wrapper around them.

At the time this was a good idea because that's all we had to work with (ie. WebForms). But now that there are so many more choices for using raw HTML the direct script approach is much cleaner.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: modalDialog is not a function
  Craig Tucker
  Rick Strahl
  Jun 5, 2020 @ 11:24am

Interesting feedback Rick.

Maybe this is for a new thread...and I know everyone as an opinion...but... What is the 'preferred' platform for website development now that WebForms is deprecated (for previous WebForm developers)?

(I hope this doesn't mean you are discontinuing ww .net tools)

Gravatar is a globally recognized avatar based on your email address. re: modalDialog is not a function
  Rick Strahl
  Craig Tucker
  Jun 5, 2020 @ 11:47am

The WebForms .NET tools have been discontinued for a long time actually. There will be no changes there and no fixes either. Whatever is there is it. There's no market left for Web Forms tooling and even if there was I don't think I want to put anymore effort into it. What's there I'll support within reason, but I don't use it enough anymore to even know all the intricacies myself without spending a ton of time to look at this each time.

Lots of options out there today. In the .NET space, ASP.NET Core offers the all in one MVC/Pages/API model and that's what I use for everything today. it's pretty much the same model that's been in use for the last 10 years just under a unified framework interface.

Then there's the whole SPA area - Angular, Vue, React etc. for building client side applications with an API backend.

Or a hybrid of SPA and server back end.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: modalDialog is not a function
  Craig Tucker
  Rick Strahl
  Jun 8, 2020 @ 08:18am

Thanks for the feedback Rick.

Is there a market for "West Wind Toolkit for MVC/Pages/API"? I did notice there were MVC modules in the current .NET toolkit although I haven't used them recently.

It is interesting there is still more of a demand/market for FoxPro than ASP.NET...

Gravatar is a globally recognized avatar based on your email address. re: modalDialog is not a function
  Rick Strahl
  Craig Tucker
  Jun 8, 2020 @ 12:16pm

Yes - ww.jquery.js is not loaded when you are calling that function.

Either make sure ww.jquery.js is declared higher up at the top of the document (you can set that in the script loader explicitly) or make sure you use $.ready(function() { $.modalDialog(); } ). Scripts get loaded automatically with the server controls but if you manually load then you have to make sure the order is right. From the problem you have I'm guessing jQuery may be loading in the header, but ww.jquery.js may be loading on the bottom of the doc.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: modalDialog is not a function
  Craig Tucker
  Rick Strahl
  Jun 8, 2020 @ 12:50pm

Hi Rick, I have that resolved now. I think you missed my last message: https://support.west-wind.com/ReplyMessage.wwt?id=5SC0QAOF0#5SC0HTANB

Thanks for the feedback Rick.

Is there a market for "West Wind Toolkit for MVC/Pages/API"? I did notice there were MVC modules in the current .NET toolkit although I haven't used them recently.

It is interesting there is still more of a demand/market for FoxPro than ASP.NET...

Gravatar is a globally recognized avatar based on your email address. re: modalDialog is not a function
  Rick Strahl
  Craig Tucker
  Jun 8, 2020 @ 07:03pm

LOL - there never was a market for West Wind ASP.NET Tools really. The market was me and you, bud!

Not really, but it wasn't widely used and completely died off when Web Forms essentially died off in the last 10 years.

The JavaScript libraries are useful, but a lot of what was in there has been made standard in higher level libraries (like tabs, modals etc.) or are just things that aren't used any more (like floating windows).

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: modalDialog is not a function
  Craig Tucker
  Rick Strahl
  Jun 11, 2020 @ 08:31am

The .NET Tools were Cool!

I seriously hope you continue to build tools and wrappers for MVC/Pages/API...!

Gravatar is a globally recognized avatar based on your email address. re: modalDialog is not a function
  Rick Strahl
  Craig Tucker
  Jun 11, 2020 @ 12:23pm

I still have library helpers for 'overall architecture' stuff like error handling custom formatters, user state management and a bunch of other stuff in my .NET Core libraries that I use all the time.

But as far as it goes to build UI components: That's just not a thing anymore at this point given that there are client side libraries Bootstrap, Material Design and various others that do that today for free. It's not quite as easy as some of the 'controls' were but relatively straight forward.

It's just a lot of effort to build and there's no chance that that can be monetized in any sensible way - I'm over building stuff that people are using and not giving back for in any way. Not pointing at you - because you've been one of the few who's always been there to buy and support whatever has come out above and beyond. But unfortunately you're a very small minority. But I thank you nevertheless for all your support both via product purchases and some of the work we've done together on projects.

+++ Rick ===

© 1996-2020