This is a migrated thread and some comments may be shown as answers.

radconfirm on page load

1 Answer 115 Views
Window
This is a migrated thread and some comments may be shown as answers.
mayank
Top achievements
Rank 1
mayank asked on 22 Nov 2008, 12:32 PM
hello all,

i am trying to call a javascript function on page load in which i call a radconfirm window....
but it showes an javascript error message like that "Undefind is null or not an object"

my code is as followes...


 

<script language="javascript" type="text/javascript">

 

 

 

// OpenWin shows how to set the OnClientClose property

// dynamically using the ASP.NET AJAX convention.

// Useful for RadWindows created on the client.

 

function OpenWin()

 

{

alert(

'mayank1');

 

radconfirm(

'Are you sure?', confirmCallBackFn, 330, 100);

 

}

 

function showDialog() {

 

alert(

"mayank");

 

 

var oWnd = window.radopen("confirmPopUp.aspx", "DialogWindow");

 

}

 

 

 

function confirmCallBackFn(arg) {

 

alert(

"Confirm returned the following result: " + arg);

 

 

if (arg == true)

 

window.parent.location =

"defaultCS.aspx";

 

 

else

 

window.parent.location =

"default.aspx";

 

 

}

 

</script>

 

</

 

head>

 

<

 

body onload="OpenWin()">

 

 

<form id="form1" runat="server">

 

 

<asp:ScriptManager ID="ScriptManager1" runat="server">

 

 

</asp:ScriptManager>

 

 

<div>

 

 

<asp:UpdatePanel ID="UpdatePanel1" runat="server">

 

 

<ContentTemplate>

 

 

<telerik:radwindowmanager runat="server" id="Singleton" >

 

<

 

Windows>

 

 

</Windows>

 

 

</telerik:radwindowmanager>

 

 

</ContentTemplate>

 

 

 

</asp:UpdatePanel>


please check it and reply some solutions...

 

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 24 Nov 2008, 06:02 AM
Hi Mayank,

In ASP.NET AJAX environment, the ASP.NET controls (including RadControls for ASP.NET AJAX) are created after the page is loaded. The problem in your code is that the function is called before the RadWindowManager is rendered on the page. You can call the OpenWin() function from the function pageLoad in order to get the RadConfirm on pageload.

ASPX:
<head runat="server"
    <title>RadConfirm</title> 
</head> 
<body> 
    <form id="form1" runat="server" > 
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server"
    <Windows> 
    </Windows>     
    </telerik:RadWindowManager> 
    <asp:ScriptManager ID="ScriptManager1" runat="server"
    </asp:ScriptManager> 
 
</form> 
</body> 

JavaScript:
<script language="javascript" type="text/javascript"
function pageLoad()  
{  
    OpenWin(); 
function OpenWin() 
    alert('mayank1'); 
    radconfirm('Are you sure?', confirmCallBackFn, 330, 100); 
 
function confirmCallBackFn(arg)  
    alert("Confirm returned the following result: " + arg); 
    if (arg == true
        window.parent.location ="defaultCS.aspx"
    else 
        window.parent.location ="default.aspx"
</script>  


Thanks,
Shinu.


Tags
Window
Asked by
mayank
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or