I have been trying to get a RadWindow I have defined on my page to open via a javascript script block I register as part of a button postback. (see code below). My page lives inside of a master page, so I don't know if that has an impact or not, but when I execute the following line:
var oWnd = $find("rwRegisterCardPopup");
my oWnd is null.
.aspx code
-------------------------
<script type="text/javascript">
<!--
function CallbackFunction_rwRegisterCardPopup(win, val)
{
var hfReturn = document.getElementById('<%= hfRegisterWindowCallback.ClientID %>');
var btn = document.getElementById('<%= btnRegisterWindowCallback.ClientId %>');
hfReturn.value = val;
btn.click();
}
function OpenPopUp_rwRegisterCardPopup(ProductId, SupplierId, Discount)
{
var oWin = $find("rwRegisterCardPopup");
if (oWin == null)
{
alert(
'Error: oWin == null is true (method1)'); //this always shows as oWin is null
oWin = $find(
"<%=rwRegisterCardPopup.ClientID%>");
}
if (oWin == null)
alert(
'Error: oWin == null is true (method2)'); //this always shows as oWin is null
else
{
var url = oWin.get_navigateUrl();
url = url +
"?GLSCProductId=" + ProductId + "&GLSCSupplierId=" + SupplierId + "&Discount=" + Discount;
oWin.setUrl(url);
oWin.show();
oWin.center();
}
}
-->
</script>
<telerik:RadWindow ID="rwRegisterCardPopup" runat="server" Title="New Reloadable Card Registration" Modal="true" Height="600px" Width="400px" Skin="WebBlue" Behaviors="Move" VisibleStatusbar="false" ClientCallBackFunction="CallbackFunction_rwRegisterCardPopup" NavigateUrl="~/orderscrip/register_card.aspx" >
</telerik:RadWindow>
.....
here's my code behind for the button that registers the Client Script Block
Private Sub ShowRegisterCardPopup(ByVal GLSCProductId As String, ByVal GLSCSupplierId As String, ByVal Discount As Decimal)
Dim java As String = "<script>alert('calling OpenPopUp_rwRegisterCardPopup()'); OpenPopUp_rwRegisterCardPopup('{0}', '{1}', '{2}');</" & "script>"
Me.ClientScript.RegisterStartupScript(Me.GetType(), "ShowRegisterCardPopup", String.Format(java, GLSCProductId, GLSCSupplierId, Discount))
End Sub
The Sub is the only code called by the button's Click handler.
My page inherits the Asp.net AJAX ScriptManager from the master page.
I tried adding the RadWindowManger and using the radopen method as well, but had no improvement with the results.
Please advise.
thanks,
Paul