We are migrating an aspx web forms application to dotvvm. In aspx codebehind, we have an ajax method which needs to be migrated to dotvvm. This ajax method is invoked from a javascript method triggered on onblur event on a textbox. So, in dotvvm, how can we invoke the viewmodel static method from the javascript method?
You can use the dot:NamedCommand control, if you are using the dotvvm view modules. You can call any command
or staticCommand
, and it will work well even in markup controls.
If you just want to call the method from some random JS, I think the easiest options is to add a hidden button on the page and then call document.getElementById("mybutton").click()
anywhere in JS. Obviously, you can only have one such button per page.