Modal popup from code behind

1 posts, 0 answers
  1. kiteloop
    kiteloop avatar
    7 posts
    Member since:
    Apr 2010

    Posted 11 Aug 2010 Link to this post

    Tested at

    RadControls version 2010 Q2
    .NET version 4.0
    Visual Studio version

    programming language

    browser support

    all browsers supported by RadControls

    This is a small snippet how to make a modal popup using RadAlert to alert errors from code behind. One of the trouble is to separate the ajax callbacks and the normal postbacks. Tried some different options how to solve this but seems to be the easiest.
    I'm using this from a BasePage-class and all the Ajax, Window, Script-manager is in a MasterPage.

    The code is borrowed from this KB

    public void Popup(string message, string title)
       var radAlertString = "radalert('" + message + "', 330, 210,'"+ title +"');";
       var radAlertScript = "<script language=\"javascript\">function f(){"+radAlertString+" Sys.Application.remove_load(f);}; Sys.Application.add_load(f);</script>";
           ScriptManager.RegisterStartupScript(this, this.GetType(), "radalert", radAlertString, true);
           Page.ClientScript.RegisterStartupScript(this.GetType(), "radalert", radAlertScript);

Back to Top