Challenge was to open the popup when button click server trip done (Page rerendered).
My method was creating a javascript at run time to open a popup. But issue was when it runs i gets a javascript error.
"Object Doesn't support this property or method"
Issue was my javascript was getting called even before its supporting js files gets load.
After some rnd i found the solution and here it is.
string strScript = "function OpenDialog() { var option = SP.UI.$create_DialogOptions(); option.url = '" + strPath + "'; option.width = 380; option.height = 330; SP.UI.ModalDialog.showModalDialog(option); } ExecuteOrDelayUntilScriptLoaded(OpenDialog, \"sp.ui.dialog.js\");";
ClientScript.RegisterClientScriptBlock(this.GetType(), "ShowStatusfunction", strScript, true);
Key thing is ExecuteOrDelayUntilScriptLoaded(OpenDialog, \"sp.ui.dialog.js\");";
What it does is, it will wait untill the specified js gets load then it will call the method
Cheers...
No comments:
Post a Comment