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

radalert problem in a postback

3 Answers 266 Views
Window
This is a migrated thread and some comments may be shown as answers.
Juan
Top achievements
Rank 1
Juan asked on 20 May 2008, 02:53 PM
hi at all

i have a problem with the radalert

i want show a radalert after  postback, i can  but my problem is that the radalert
continuous showing in each postback or if i push on the update page button.
my code is this

on the server
//I use this because a iam using a RadAjaxManager   
 RadAjaxManager1.ResponseScripts.Add("Sys.Application.add_load(pru);")

on the client

function pru()
{
    var owdn=radalert("say something");
    owdn.add_close(clean);
}
function clean()
{
    Sys.Application.remove_load(pru);
// this function is solution to my problem , but isn't  complete because if i press a //update button, the radalert come back againĀ”
}
what can i do ? what's wrong ? iam programming on visual basic 2005





3 Answers, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 21 May 2008, 02:08 PM
Hello Juan,

This happens because you have added the script that shows the alert to the RadAjaxManager's ResponseScripts collection. To avoid it, you need to implement a server-side check that will add the script only when needed and to clear it after that.



Best wishes,
Georgi Tunev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Lenny_shp
Top achievements
Rank 2
answered on 31 Oct 2008, 02:08 PM
Can you provide some technique of checking and clearing on the server side?
It seems after adding it on a button event then after postback, it script count is always 0.

RadAjaxManager1.ResponseScripts.Add("Sys.Application.add_load(function(){radalert('Not Available Yet');});")





            If RadAjaxManager1.ResponseScripts.Count > 0 Then
                RadAjaxManager1.ResponseScripts.RemoveAt(0)
            End If
0
Lenny_shp
Top achievements
Rank 2
answered on 31 Oct 2008, 02:08 PM
I found this example in the KB article.

RadAjaxManager1.ResponseScripts.Add("(function(){var f = function(){radalert('Welcome to RadWindow Prometheus!', 330, 210);Sys.Application.remove_load(f);};Sys.Application.add_load(f);})()")
Tags
Window
Asked by
Juan
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Lenny_shp
Top achievements
Rank 2
Share this question
or