A Simple RADWindow Example

13 posts, 0 answers
  1. cdikmen
    cdikmen avatar
    25 posts
    Member since:
    Aug 2006

    Posted 27 Mar 2009 Link to this post

    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?
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 30 Mar 2009 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. rs
    rs avatar
    3 posts
    Member since:
    Aug 2009

    Posted 04 Nov 2009 Link to this post

    How can we set the value from a content wondow to the calling page control... lets say comments
  5. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 05 Nov 2009 Link to this post

    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
  6. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 05 Nov 2009 Link to this post

    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.
  7. fenix2222
    fenix2222 avatar
    13 posts
    Member since:
    Sep 2008

    Posted 19 Nov 2009 Link to this post

    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?
  8. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 20 Nov 2009 Link to this post

    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.
  9. Shyamala
    Shyamala avatar
    2 posts
    Member since:
    Jun 2012

    Posted 13 Jun 2012 Link to this post

    other than query string how can we pass values to the Page load in server side.
  10. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3600 posts

    Posted 15 Jun 2012 Link to this post

    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.
  11. Shyamala
    Shyamala avatar
    2 posts
    Member since:
    Jun 2012

    Posted 15 Jun 2012 Link to this post

    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 ..?
  12. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3600 posts

    Posted 18 Jun 2012 Link to this post

    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.
  13. Adrian
    Adrian avatar
    7 posts
    Member since:
    Jul 2012

    Posted 13 Aug 2012 Link to this post

    Hi. Just a quick note to let you know that the link for Using RadWindow as a Dialog is broken.
  14. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3600 posts

    Posted 14 Aug 2012 Link to this post

    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017