I have created an application page that mimics an input form. This form will eventually go into an SP List with other forms. What I'm after is when a user clicks the link to the form from the SP List, it will open the application page in a modal dialog.
I have used Modal Dialogs in SharePoint before, but that is always after some user event such as a button click or hyperlink navigation, but never on page load.
I have tried using JS with:
window.onload = function() { SP.UI.ModalDialog.ShowPopupDialog(myURL); }
but that didn't work.
I also tried Registering the script on start up in code-behind, but that does nothing as well.
Any help will greatly be appreciated. Thanks