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

RadAjaxManager.Alert

5 Answers 400 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
AP
Top achievements
Rank 1
Veteran
AP asked on 03 Dec 2020, 06:51 AM

Hi,

        RadAjaxManager.GetCurrent(Me.Page).Alert("Please enter all mandatory fields")

 

This line throws a blank page and it shows the parameter values in URL. How can i restrict this and avoid the blank page? 

please help me on this. 

thanks,

ArunPrasad

5 Answers, 1 is accepted

Sort by
0
Vessy
Telerik team
answered on 03 Dec 2020, 12:17 PM

Hello,

One suggestion is calling radlalert from code behind which allows additional parameters like dialog width and height and a title alert.
C#. Add RadWindowManager on the page and the following code when you need to show an alert from the server-side:

You can checkout this article for more information on this matter:

https://docs.telerik.com/devtools/aspnet-ajax/controls/window/how-to/using-radconfirm-in-server-code

For example:

    string radalertscript = "<script language='javascript'>function f(){radalert('Some custom alert message!', 330, 210,'My Title'); Sys.Application.remove_load(f);}; Sys.Application.add_load(f);</script>"; 
    Page.ClientScript.RegisterStartupScript(this.GetType(), "radalert", radalertscript); 

Regards,
Vessy
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
AP
Top achievements
Rank 1
Veteran
answered on 17 Dec 2020, 02:51 AM
0
AP
Top achievements
Rank 1
Veteran
answered on 17 Dec 2020, 02:54 AM

Hi Vessy,

     Please ignore my previous post. 

 

I used window.history.back(); to avoid the blank page restriction. It redirects to the same page after the alert popup. Now everything is fine. Thank you for your response Vessy.

 

Thanks,

ArunPrasad

0
AP
Top achievements
Rank 1
Veteran
answered on 17 Dec 2020, 03:00 AM
Hi Vessy,
     Please ignore my previous post. (Don't know how to delete the post that wrongly posted)

I used window.history.back(); to avoid the blank page redirection. The above  code is redirects to the same page after the alert popup. Now everything is fine. Thank you for your response Vessy.

Thanks,
ArunPrasad
0
Accepted
Vessy
Telerik team
answered on 18 Dec 2020, 05:23 PM

Hi,

Thanks a lot for the update, ArunPrasad - I am glad everything works properly now.

Regards,
Vessy
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Allen
Top achievements
Rank 2
Iron
Veteran
commented on 08 Dec 2021, 01:19 PM

If I want to use standard javascript alert messages everywhere but take advantage of this approach, is that possible?  An example?

Current code looks like:


                        log_debug(`Found ${numBridges} selected bridges - processing selected bridges cannot continue`);
                        let msg = genAlertWarningMessage("The desktop list has no bridges.  Please choose another layout or clear or reset the filters for this list to show at least 1 bridge for processing";
                        let oWnd = window.radalert(msg, 400, 200, "No Bridges In Desktop List", "confirmNoBridgesInListCallBackFn", "");

 

which shows  a radalert window with an icon and message.  

In another place is server-side code, written by an ex-developer, an alert is shown like this:


 protected void CheckSessionState()
        {
             Logger.Instance.Debug("CheckSessionState() - started.");

            if (HttpContext.Current == null || HttpContext.Current?.Session?.IsNewSession == true)
            {
                // dead session
                RadAjaxManager.GetCurrent(Page).Alert(Globals.MSG_EXPIRED_ALERT);
                Logger.Instance.Debug($@"{this.ToString()} '{Request.RawUrl}' redirects to Expiration");
                Response.Redirect("~/Expiration.aspx", false);
                HttpContext.Current?.ApplicationInstance?.CompleteRequest();

            }

     // do other stuff because we have a Session
      ...
      ...
      ...


}

which generates  an Alert with the RadAjaxManager that is extremely simple in format, just a black box with a message in white.  I don't really care that much what shows up as long as the alerts are consistent, but I slightly favor a popup window.

Is there a way to sort this out so that RadAjaxManager.Alert()   generates the same thing as the first code?

Vessy
Telerik team
commented on 13 Dec 2021, 01:13 PM

Hi Allen, 

The RadAjaxManager shows very simple alerts and, unfortunately, it cannot who RadAlert-like popups. If your application structure allows that, though, you can replace the AjaxManager alerts with RadAlerts as well.

Allen
Top achievements
Rank 2
Iron
Veteran
commented on 17 Dec 2021, 05:41 PM

OK.  Thank you.  Suggest in the future maybe provide templating the alerts for RadAjaxManager?
Vessy
Telerik team
commented on 20 Dec 2021, 02:33 PM

Thank you for the shared suggestion, Allen! I have logged as a feature request in our Feedback portal and our developers will consider its implementation depending on the popularity of the item. You can track its progress here:

https://feedback.telerik.com/aspnet-ajax/1547075

Tags
Ajax
Asked by
AP
Top achievements
Rank 1
Veteran
Answers by
Vessy
Telerik team
AP
Top achievements
Rank 1
Veteran
Share this question
or