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

RadAlert Shows every time

2 Answers 37 Views
Window
This is a migrated thread and some comments may be shown as answers.
Eric
Top achievements
Rank 1
Eric asked on 09 Apr 2009, 03:33 PM
I have a piece of code that on save click it validates the users data input.
  If myErrorMsg.Length > 0 Then  
            'myErrorMsg.Insert(0, "Please fix the following errors: <br/>", 1)  
            'RadAjaxManager1.Alert(myErrorMsg.ToString)  
            ScriptManager.RegisterStartupScript(Page, GetType(Page), "RadAlertScript", "Sys.Application.add_load(function(){radalert('" & myErrorMsg.ToString & "',330,210,'Please fix the following errors: ');});", True)  
        End If 
This works fine.  If the data is not correct it will pop the RadAlert.  The issue is if the user does not leave the screen and selects another entry from the grid, it pops the Radalert with every update.

The pages uses RadAjaxManager , RadWindows manager, and acouple of RadGrids.  I only want the RadAlert to show when the save button is clicked and there is an error in the data collected.

2 Answers, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 10 Apr 2009, 01:15 PM
Hello Eric,

I believe that the following KB will be of help:
http://www.telerik.com/support/kb/aspnet-ajax/window/calling-radalert-from-codebehind.aspx

In general the idea is to remove the radalert() function from Sys.Application.Load() once it is executed - otherwise it will be called every time like in your case.


Best wishes,
Georgi Tunev
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
Eric
Top achievements
Rank 1
answered on 10 Apr 2009, 02:11 PM
Thanks, the third solution works perfect.
Tags
Window
Asked by
Eric
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Eric
Top achievements
Rank 1
Share this question
or