Pass Soubroutine to okscript / cancelscript of Alert

Aug 13, 2012 at 10:05 PM

Hi

I need help urgently please. How do I call a .net subroutine or c# soubroutine by passing the name to the okscript of the alert class.

Below is the source code in the Confirm.cs class

public static void Show(string message, string title, MessageBoxIcon icon, string okScriptstring, string cancelScript)
        {
            PageContext.RegisterStartupScript(GetShowReference(message, title, icon, okScriptstring, cancelScript));
        }

Currently I can pass:  "window.location.href='frmXXX.aspx?action=delete';" as okScripting and this works well. How do I pass a function other than javascript to okscripting?

Coordinator
Aug 16, 2012 at 2:51 AM

Suppose you have defined a function:

window.nav = function() {
    window.location.href='frmXXX.aspx?action=delete';
};
Then you can invoke the Show method like this:
Confirm.Show("message", "title", .., "nav();", "");