Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
55
Showing from a postback...
posted

I have the need to show a popup when the page is load. I could do this with the Microsoft popup control as it has the ability to call the show function from the codebehind like this:

 oPopup.Show();

 The WebDialogWindow seems to only be fired from javascript.

 I tried adding the javascript to the body tag:

<body onload="modalshow('sControlID');">

but this does not work.

 

My Javascript is defined as:

 

script type="text/javascript" >

var oWebDialogWindow = null;

function modalShow(sControlID)

{

oWebDialogWindow = $find(sControlID);

 

if(oWebDialogWindow != null)

oWebDialogWindow.show();

}

oWebDialogWindow always comes back as null.

 

How can I do a show triggered from a postback?

 

Parents
  • 19308
    posted

    The dialog will come back as null for one of 2 reasons.  Either the id is incorrect (the dialog may be nested inside of an INamingContainer), or the more likely cause is that your script is executing before the dialog control has actuall been created on the client side. 

    I would recommend using the Initialize event of the WebDialogWindow and checking a flag which determines the initial visibility of the control.  You can toggle the flag in your "modalShow" function rather than actually showing the dialog window. 

    I think having a .show method available on the serverside is a very useful shortcut, so I will definitely be forwarding this on to our team as a feature request.

    -Tony

Reply Children