RadAlert Shows every time

3 posts, 0 answers
  1. Eric
    Eric avatar
    20 posts
    Member since:
    Jul 2008

    Posted 09 Apr 2009 Link to this post

    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. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 10 Apr 2009 Link to this post

    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.
  3. Eric
    Eric avatar
    20 posts
    Member since:
    Jul 2008

    Posted 10 Apr 2009 Link to this post

    Thanks, the third solution works perfect.
Back to Top