Programmatically create a Rad Window

9 posts, 2 answers
  1. M. R.
    M. R. avatar
    49 posts
    Member since:
    Dec 2009

    Posted 27 Feb 2012 Link to this post

    Hello,

    I am using the latest 2011 Ajax .Net version (2011 Q3). Can you please provide an example about how to programmatically create a Rad Alert with custom html text content?
    Also, the  Rad Alert should auto-size (if possible?) and I need to control the position of the 'Ok' button.

    What I am trying to achieve is to display a modal window (created by code) once I click on some areas of the page. This is necessary because I am pulling information from a database.

    Regards,
    M.R.
  2. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 28 Feb 2012 Link to this post

    Hello,

    Take a look into the following.
    Calling radalert from codebehind (all versions of RadWindow)
    radAlert with Autosize

    Try the following CSS to control the position of the "OK" button.
    CSS:
    <style type="text/css">
     .RadWindow .rwPopupButton
      {
       margin: 8px 8px 8px 90px !important;
      }
    </style>


    Thanks,
    Princy.
  3. M. R.
    M. R. avatar
    49 posts
    Member since:
    Dec 2009

    Posted 28 Feb 2012 Link to this post

    Thank you very much Princy!

    Regards,
    M.R.
  4. M. R.
    M. R. avatar
    49 posts
    Member since:
    Dec 2009

    Posted 28 Feb 2012 Link to this post

    Sorry, I have another problem: the code works ok but every time I refresh the page the Rad window displays again on the screen.

    Please advise how to avoid this behavior.

    Regards,
    M.R.
  5. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 28 Feb 2012 Link to this post

    Hello,

    You might be setting VisibleOnPageLoad property of RadWindow as true. To avoid RadWindow from reloading on refreshing the page try setting VisibleOnPageLoad property of RadWindow to false.

    Thanks,
    Princy.
  6. M. R.
    M. R. avatar
    49 posts
    Member since:
    Dec 2009

    Posted 29 Feb 2012 Link to this post

    I am programatically displaying a Rad alert, how can I set VisibleOnPageLoad property?  The alert displays correctly when I press a button but shows again if I refresh the page... Here is the code:

     

    Dim sRadAlertScript As String = "<script language='javascript'>function f(){radalert('Test 1', 330, 210, 'window title');Sys.Application.remove_load(f);}; Sys.Application.add_load(f);</script>" 
      
    Page.ClientScript.RegisterStartupScript(Me.[GetType](), "radalert", sRadAlertScript) 

    Thanks,
    M.R.
  7. M. R.
    M. R. avatar
    49 posts
    Member since:
    Dec 2009

    Posted 01 Mar 2012 Link to this post

    I am programatically displaying a Rad alert, how can I set VisibleOnPageLoad property?  The alert displays correctly when I press a button but shows again if I refresh the page... Here is the code:

     

    Dim sRadAlertScript As String = "<script language='javascript'>function f(){radalert('Test 1', 330, 210, 'window title');Sys.Application.remove_load(f);}; Sys.Application.add_load(f);</script>" 
      
    Page.ClientScript.RegisterStartupScript(Me.[GetType](), "radalert", sRadAlertScript) 

    Thanks,
    M.R.
  8. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 02 Mar 2012 Link to this post

    Hello,

    Take a look into the following demo.
    Window / Alert, Prompt, Confirm

    Thanks,
    Princy.
  9. M. R.
    M. R. avatar
    49 posts
    Member since:
    Dec 2009

    Posted 02 Mar 2012 Link to this post

    Thanks Princy, all I had to do was to put the ASP button inside  a RadAjaxPanel.

    Regards,
    M.R.
Back to Top