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

RadAlert With RadAjax Issues

3 Answers 167 Views
Window
This is a migrated thread and some comments may be shown as answers.
Balamurali Venkatesan
Top achievements
Rank 1
Balamurali Venkatesan asked on 06 Jul 2009, 11:54 AM
Hi,

Iam using the below code to display a Rad Alert box and redirecting to a new page
string message="Displkay Alert Message";

radAjaxManager.ResponseScripts.Add("radalert('" + message + "', 250, 100);

 

For redirecting we are using the javascript redirect: window.location.href ="NewPage.aspx".

The issue here is the page gets redirected first and is not waiting for the OK button click on the Radalert.
When we use normal alert the page is actually waiting for the user to click the OK button and then the new page is getting loaded

Any help on this greatly appreciated
Thanks and Regards
V.Balamurali

3 Answers, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 06 Jul 2009, 12:49 PM
Hello Balamurali,

This behavior is expected - the radalert, radprompt and radconfirm dialogs cannot block the execution thread as this is something that cannot be done with JavaScript. There is an easy workaround though - to hook to the OnClientClose event of the radalert object and to execute the code there.
e.g.:

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<script runat="server"
 
</script> 
 
<html xmlns="http://www.w3.org/1999/xhtml"
<head runat="server"
    <title></title
</head> 
<body> 
    <form id="form1" runat="server"
    <asp:ScriptManager ID="ScriptManager1" runat="server"
    </asp:ScriptManager> 
 
    <script type="text/javascript"
 
        function alertAndNavigate() 
        { 
            var oWnd = radalert("You will be redirected to Google"); 
            oWnd.add_close(function() 
            { 
                window.location.href = "http://www.google.com"
            }); 
        } 
     
     
     
    </script> 
 
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server"
    </telerik:RadWindowManager> 
    <button onclick="alertAndNavigate(); return false;"
        open RadAlert and navigate the page after that</button> 
    </form> 
</body> 
</html> 


Kind regards,
Georgi Tunev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Balamurali Venkatesan
Top achievements
Rank 1
answered on 06 Jul 2009, 01:50 PM
Hi,

Thanks a lot for the qucik response.Actually we need to show the Alert based on certain conditions on the server .
The code which you suggested will display the alert message whenever they click the button. But in our case on server side button click event based on certain condiitons we need to display the alert and redirect to a new page.

Thanks and Regards,
V.Balamurali
0
Georgi Tunev
Telerik team
answered on 07 Jul 2009, 06:27 AM
Hello Balamurali,

It doesn't matter if you call this code directly on the client or output it from the server - the logic still stays the same. As for outputting the JavaScript function from the server and executing it, this is a general programming task that is not directly related to the RadWindow control. There are various ways to do this which depend on the setup and the logic that you want to use. For example you could examine the suggestions provided in this blog post:
http://blogs.telerik.com/blogs/09-05-05/executing_javascript_function_from_server-side_code.aspx


Regards,
Georgi Tunev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Window
Asked by
Balamurali Venkatesan
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Balamurali Venkatesan
Top achievements
Rank 1
Share this question
or