Hello.
I have an AjaxEnabled web app, a Content page, and a WebDialog control on it named "dlgWait".
The control is initially hidden. The application is "Style Enabled" and am using "Default".
I've tied the call to "showDialog()" (below) to an image button.
When the javascript runs, variable "d" is null after $find() is called.
I can't figure it out.
I did notice that the javascript emitted from RegisterClientScriptBlock is not located between the <head></head> tags, because this is a content page.
Thanks in advance,
Mike
Here's the code in the Content page to register the BLOCKED SCRIPT
' Emit javascript to show the dialog window when a new date is selected:If Not ClientScript.IsClientScriptBlockRegistered("showDialog") Then Dim sb As New StringBuilder() Dim s As String = "<script language=""javascript"">" sb.Append(s) s = "function showDialog() {" sb.Append(s) s = "var d = $find(""dlgWait""); " sb.Append(s) s = "d.show();" sb.Append(s) s = "} </script>" sb.Append(s) ClientScript.RegisterClientScriptBlock(Me.GetType(), "showDialog", sb.ToString(), False)End If
Nevermind. I changed $find(""dlgWait"") to $find("" & me.dlgWait.ClientID & "")" and now it works.
Yep, ClientID are different from server IDs if the control is nested in INamingContainers (master page, user control, templates, etc). You can use something similar to that below:
$find("<%= digWait.ClientID %>");