What scenario would be best in this RadAlert situation?

3 posts, 1 answers
  1. Boris
    Boris avatar
    275 posts
    Member since:
    Oct 2012

    Posted 29 Jul 2013 Link to this post

    I've been using the RadWindow.RadAlert as an error popup in a number of situations, usually in various RadGrid events.

    Now I have an aspx that I'm calling from within a Radgrid using a window.radopen call.  Once the window is open, it's closed by hitting a RadButton and generating a  ClientScript.RegisterStartupScript(Page.GetType(), "", "CloseAndRebind();", true) in it's OnClick event.   This is all pretty much based on your demos.

    However in this event I have error trapping and what I want to do is when the code errors out is to instead generate an error popup.  What I have within the catch statement is a RadWindowManager.RadAlert and a return.  This is not working.

    Suggestions?
  2. Answer
    Danail Vasilev
    Admin
    Danail Vasilev avatar
    1493 posts

    Posted 01 Aug 2013 Link to this post

    Hello Boris,

    I have tried to reproduce the unexpected behavior but to no avail. You can watch a short video with the test in the attached archive and then tell me what I am missing.

    Could you also try to reproduce the issue with the attached VS example and then paste the changes, so that I can make an investigation locally?

    Regards,
    Danail Vasilev
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Boris
    Boris avatar
    275 posts
    Member since:
    Oct 2012

    Posted 02 Aug 2013 Link to this post

    Let's ignore this one.  I must have been asleep when I wrote it.  My real problem is that in my early use of radalerts I was, for lack of a better, in an Ajaxified situation whether I recognized it or not.  In this the code was not working because I was in an ordinary button-triggered postback situation, so a RegisterStartupScript method was the only way to go.  My apologies to Danail and I promise to try and not post when in a caffeine-deprived (or over-caffeinated) condition. 

    --------------------------------------------------

    Actually I really haven't done that much with RadWindows other than copying a couple of your more basic demos.
    I'm not sure I fully understand your example either.  But I think this example might better illustrate what I could be doing wrong.  
    (I found another one of your demos that seems to work in my situation.)
    In a basic aspx I have a RadWindowManager and a RadButton.  In the code behind I have the following.  

    The commented out RadWindowManager.RadAlert is the original problem, what I was using in other applications, mostly from RadGrid events as I recall.  That fails in this situation.  The register call does work.  (I've attached an image of the entire ASPX.

      protected void RadButton1_Click(object sender, EventArgs e)
            {
                try
                {
                    throw new Exception();
                }
                catch (Exception ex)
                {
                    ShowErrorMessage("test", ex.Message);
                }

            }

            private void ShowErrorMessage(string sErrorSource, string sErrorMessage)
            {
                //http://www.telerik.com/support/kb/aspnet-ajax/window/calling-radalert-from-codebehind.aspx
                string s = "Error message = " + sErrorMessage;
                s = s.Replace("'", " ");
                s = s.Replace('\r', ' ');
                s = s.Replace('\n', ' ');
                string radalertscript = "<script language='javascript'>function f(){radalert('" + s + "</b>', 600, 210, '" + sErrorSource + "'); Sys.Application.remove_load(f);}; Sys.Application.add_load(f);</script>";
                Page.ClientScript.RegisterStartupScript(this.GetType(), "radalert", radalertscript);                    
    //            RadWindowManager1.RadAlert("Error = " + sErrorMessage, 500, 200, "Error in " + sErrorSource, "");
            }
Back to Top