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

Programmatically create a Rad Window

8 Answers 280 Views
Window
This is a migrated thread and some comments may be shown as answers.
M. R.
Top achievements
Rank 1
M. R. asked on 27 Feb 2012, 09:19 PM
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.

8 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 28 Feb 2012, 06:17 AM
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.
0
M. R.
Top achievements
Rank 1
answered on 28 Feb 2012, 03:17 PM
Thank you very much Princy!

Regards,
M.R.
0
M. R.
Top achievements
Rank 1
answered on 28 Feb 2012, 09:15 PM
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.
0
Princy
Top achievements
Rank 2
answered on 29 Feb 2012, 05:30 AM
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.
0
M. R.
Top achievements
Rank 1
answered on 29 Feb 2012, 03:41 PM
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.
0
M. R.
Top achievements
Rank 1
answered on 01 Mar 2012, 06:09 PM
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.
0
Accepted
Princy
Top achievements
Rank 2
answered on 02 Mar 2012, 07:31 AM
Hello,

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

Thanks,
Princy.
0
M. R.
Top achievements
Rank 1
answered on 02 Mar 2012, 04:09 PM
Thanks Princy, all I had to do was to put the ASP button inside  a RadAjaxPanel.

Regards,
M.R.
Tags
Window
Asked by
M. R.
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
M. R.
Top achievements
Rank 1
Share this question
or