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

What scenario would be best in this RadAlert situation?

2 Answers 27 Views
Window
This is a migrated thread and some comments may be shown as answers.
Boris
Top achievements
Rank 1
Boris asked on 29 Jul 2013, 03:29 PM
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 Answers, 1 is accepted

Sort by
0
Accepted
Danail Vasilev
Telerik team
answered on 01 Aug 2013, 02:50 PM
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.
0
Boris
Top achievements
Rank 1
answered on 02 Aug 2013, 07:36 PM
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, "");
        }
Tags
Window
Asked by
Boris
Top achievements
Rank 1
Answers by
Danail Vasilev
Telerik team
Boris
Top achievements
Rank 1
Share this question
or