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

RadAlert embedding JS code

2 Answers 102 Views
Window
This is a migrated thread and some comments may be shown as answers.
Brian Mains
Top achievements
Rank 1
Brian Mains asked on 06 Apr 2009, 08:30 PM
Hello,

I want to embed in the rad alert JavaScript code to display a running count-down counter.  Is that possible?

Thanks.

2 Answers, 1 is accepted

Sort by
0
Accepted
Georgi Tunev
Telerik team
answered on 07 Apr 2009, 06:34 AM
Hello Brian,

Yes, you could do that by modifying the radalert template as shown in the Changing the Dialog Templates help article. Please note that the templates allow standard HTML only - you cannot use server controls in it.



Best wishes,
Georgi Tunev
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
Accepted
Shinu
Top achievements
Rank 2
answered on 07 Apr 2009, 08:31 AM
Hello Brian,

I guess you want to include a running count-down counter in RadAlert for auto closing the alert. I tried following code for that. Please give a try with that.

[ASPX]:
 
<input id="Button5" type="button" value="Show Alert" onclick="showAlert();" /> 

[JavaScript]:
 
<script type="text/javascript"
var rAlert; 
var alertText = ' Window will colse within 4 seconds'
function showAlert() 
    var text = 1; 
    rAlert = radalert(alertText); 
    var count = countdown(4000); 
var c=0; 
function countdown(c) 
    c=c-1000; 
    if(c==0) 
    { 
        rAlert.close();  
        return
    } 
    else 
    { 
        setTimeout('countdown(' + c + ')',1000); 
        rAlert.get_contentElement().innerText = 'Alert will close within  '+c/1000+ ' seconds'
    } 
</script> 

Thanks,
Shinu.
Tags
Window
Asked by
Brian Mains
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Shinu
Top achievements
Rank 2
Share this question
or