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

A Simple RADWindow Example

12 Answers 1263 Views
Window
This is a migrated thread and some comments may be shown as answers.
cdikmen
Top achievements
Rank 1
cdikmen asked on 27 Mar 2009, 02:11 PM
Version Q1 2008
VS 2008

I have what I consider to be a REAL simple requirement for RADWindow and I am NOT a Javascript person AT ALL. The examples on the Telerik site are far too complex for what I need. I have been struggling for 2 days just to do the following simple task.

I have an ImageButton on an aspx page.
When I click on the ImageButton I want to open a modal RADWindow, say 400 pixels X 200 pixels.
I want the RADWindow to display the contents of an .aspx form
I need to pass a parameter to the .aspx form that is displayed in the RADWindow

For example, if I were simply opening the .aspx page, by NavigateURL would be "~/folder/form.aspx?Id=100"

Is there a simple way to do this?

12 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 30 Mar 2009, 07:03 AM

Hello,

The easy way to pass parameters is to supply query string parameters to the window URL. These parameters can be read on the server in the Page_Load method of the page being loaded in the window. See the example.

Parent Page;
ASPX:

<telerik:radwindowmanager id="RadWindowManager1" Width="400" Height="200" Modal="true" runat="server" DestroyOnClose="true">      
</telerik:radwindowmanager>    
<asp:ImageButton  runat="server" OnClientClick="return openRadWindow();" ImageUrl="~/Images/Refresh.gif" />    
<asp:TextBox ID="TextBox1" runat="server" Text="hi"></asp:TextBox>  

JavaScript:

<script type="text/javascript">   
function openRadWindow()   
{  
    var value= document.getElementById("TextBox1").value;   
    var oWnd = radopen("ContentWindow.aspx?value=" +value, "RadWindow1" ); //Pass parameter using URL   
    oWnd.center();   
    return false;  
}   
</script>  

Content Window;
ASPX:
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> 

CS:
protected void Page_Load(object sender, EventArgs e)  
{  
    string value = Page.Request.QueryString["value"]; // Get the parameter server side.          
    TextBox1.Text = value;  

Thanks,
Princy.
0
rs
Top achievements
Rank 1
answered on 04 Nov 2009, 09:58 PM
How can we set the value from a content wondow to the calling page control... lets say comments
0
Shinu
Top achievements
Rank 2
answered on 05 Nov 2009, 07:00 AM
Hi,

You can access the control in parent page from content window using the following client side code.

javascript:
 
<script type="text/javascript"
    function changeText() { 
        var text = GetRadWindow().BrowserWindow.document.form1.TextBox1.value; // Where TextBox1 is placed in parent page 
        alert(text); 
    } 
    function GetRadWindow() { 
        var oWindow = null
        if (window.radWindow) oWindow = window.radWindow; 
        else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow; 
        return oWindow; 
    } 
</script> 

 If you want to pass the value on closing the window, then you can return the argument in the OnclientClose eventHandler as shown in the documentation: Using RadWindow as a Dialog

-Shinu
0
Georgi Tunev
Telerik team
answered on 05 Nov 2009, 11:54 AM
Hello rs,

I believe that the following documentation topic will be of help:
 http://www.telerik.com/help/aspnet-ajax/window-programming-using-radwindow-as-dialog.html

Sincerely yours,
Georgi Tunev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
fenix2222
Top achievements
Rank 2
answered on 20 Nov 2009, 12:08 AM
I have a simple scenario, but still not sure how to achieve it. I have a page that has a button called "change theme", what I need to do is when button is clicked I display a modal window with a list of skins. When user selects a skin it has to close modal window and update skin for parent window. I know hot to get selected theme and how to open/close radwindow, but it is all on client side. Once I get selected skin on the client side, how do I pass it to server side, as skins can only be changed there. WebMethods wont work as these a static and dont have access to current page?
0
Georgi Tunev
Telerik team
answered on 20 Nov 2009, 07:56 AM
Hello Igor,

Sending arguments from the client to the server with JavaScript is a general programming task - for example you can use __doPostBack() or if you ajaxify your form with RadAjax's, you can use ajaxRequest call to do this.

All the best,
Georgi Tunev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Shyamala
Top achievements
Rank 1
answered on 13 Jun 2012, 12:12 PM
other than query string how can we pass values to the Page load in server side.
0
Marin Bratanov
Telerik team
answered on 15 Jun 2012, 08:40 AM
Hi Shyamala,

On the server it is almost impossible to access one page from the other so querystrings are one of the easiest approaches. You can also store data in the Session and Cache or even in a database, but this is not related to the RadWindow and depend on your own logic, needs and limitations.


Regards,
Marin Bratanov
the Telerik team
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 their blog feed now.
0
Shyamala
Top achievements
Rank 1
answered on 15 Jun 2012, 12:17 PM
Hi Dear,
 
There is something like data that we can pass in the Jquery Ajax Post. Similarly i want to know for Radwindow,. there is something called Argument .can u give example of how to work with it ..?
0
Marin Bratanov
Telerik team
answered on 18 Jun 2012, 10:27 AM
Hi,

You can create a custom JavaScript object and pass it through the RadWindow object. The approach is shown in action in this help article and this online demo.


Greetings,
Marin Bratanov
the Telerik team
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 their blog feed now.
0
Adrian
Top achievements
Rank 1
answered on 13 Aug 2012, 05:10 PM
Hi. Just a quick note to let you know that the link for Using RadWindow as a Dialog is broken.
0
Marin Bratanov
Telerik team
answered on 14 Aug 2012, 02:03 PM
Hi Adrian,

Thank you for noting this. I have fixed the links in the old post and in yours. My last reply also had the correct link:
http://www.telerik.com/help/aspnet-ajax/window-programming-using-radwindow-as-dialog.html
You may also find useful the online demo that shows this in action:
http://demos.telerik.com/aspnet-ajax/window/examples/dialogreturnvalue/defaultcs.aspx


All the best,
Marin Bratanov
the Telerik team
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 their blog feed now.
Tags
Window
Asked by
cdikmen
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
rs
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Georgi Tunev
Telerik team
fenix2222
Top achievements
Rank 2
Shyamala
Top achievements
Rank 1
Marin Bratanov
Telerik team
Adrian
Top achievements
Rank 1
Share this question
or