Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Window > opening a radwindow from code-behind
RadControls for ASP.NET are no longer supported (see this page for reference). In case you have inquiries about the Telerik ASP.NET AJAX controls, post them in the pertinent ASP.NET AJAX forums.

opening a radwindow from code-behind

Feed from this thread
  • xyz avatar

    Posted on May 24, 2007 (permalink)

    Hi,

    <radw:radwindowmanager id="RadWindowManager1" runat="server">

    <Windows>

    <radw:RadWindow ID="showRadWindow" Left="200" Top="" Behavior="close" SkinsPath="~/RadControls/Window/Skins" width="250px" Height="730px" Modal="true" />

    </Windows>

    </radw:radwindowmanager>

    i am right now doing like this to open a window from my html

    var x = window.radopen("../PopUp/display.aspx?");

    Can i show the pop up from the code-behind.

    depending on certain condition, can i show display.aspx from code-behind.

    thanks
    tyra

  • Georgi Tunev Georgi Tunev admin's avatar

    Posted on May 25, 2007 (permalink)

    Hello Tyra,

    Yes, you can open RadWindows from the codebehind.
    Generally speaking, to show a RadWindow in this way you will need to :
    1. Create it on the server
    2. Set its ID property (to be able to operate with it on the client  if needed after that)
    3. Set its NavigateUrl property
    4. Set its VisibleOnPageLoad property to true
    5. Add it to the RadWindowManager's Windows collection.

    e.g:

    Telerik.WebControls.RadWindow newwindow = new Telerik.WebControls.RadWindow();  
    newwindow.ID = "RadWindow1";  
    newwindow.NavigateUrl = "http://www.google.com";  
    newwindow.VisibleOnPageLoad = true;  
    RadWindowManager1.Windows.Add(newwindow); 


    More information on the subject is available in the documentation, section RadWindow Server-Side.



    Sincerely yours,
    Georgi Tunev
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center

  • chookieeee avatar

    Posted on May 27, 2007 (permalink)

    hi,

    that shows us how to create the window from code behind, but how do you open it??

    i dont think the documentation is clear on how to open a rad window from code behind. it gives the example for radalert, but not rad window.

    could you please help??
    thanks!
    dan

  • Georgi Tunev Georgi Tunev admin's avatar

    Posted on May 28, 2007 (permalink)

    Hello Dan,

    As noted in the "Setting Server-side Properties" article in the RadWindow Server-Side section, you can get a reference to the RadWindows in the Windows collection of the RadWindowManager

    //Get a reference to the first window in the list

    RadWindow firstWindow = WindowManager.Windows[0];

    an alternative syntax is
    RadWindow firstWindow = WindowManager.Windows["RadWindow2"];


    Now when you have a reference to the RadWindow in the collection, just set its VisibleOnPageLoad property to true. This way the RadWindow will be shown after the postback.




    Best wishes,
    Georgi Tunev
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center

  • chookieeee avatar

    Posted on May 28, 2007 (permalink)

    Hi Georgi,
    thanks for your reply.

    i dont know if i've missed something, but my window doesnt seem to open when i try this. heres my code:
        protected void gridContextMenu_ItemClick(object sender, RadMenuEventArgs e)  
        {  
            switch (e.Item.Text)  
            {  
                case "View Revision History and Download":  
                    {  
                        RadWindow downloaddoc = RadWindowManager1.Windows["DownloadDocWindow"];  
                        downloaddoc.NavigateUrl = "DocForm.aspx?dbID=" + RadGrid1.SelectedItems[0].Cells[2].Text + "&type=download";  
                        downloaddoc.Visible = true;  
                        downloaddoc.VisibleOnPageLoad = true;  
                    }  
                    break

    got any ideas?
    dan

  • Petya Petya admin's avatar

    Posted on May 29, 2007 (permalink)

    Hi,

    Would you please verify that you do get into the case "View Revision History and Download"? Your code seems correct, so we will kindly ask you to send us a working project demonstrating the issue so we can investigate the problem. Looking forward to your reply.


    Sincerely yours,
    Petya
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center

  • chookieeee avatar

    Posted on May 30, 2007 (permalink)

    hi.
    i actually changed it around a bit and made it work on client side instead.. because i knew that would work. but theres a few windows i want to open up on server side so when that happens ill send u my project. thanks a lot!!

    dan

  • fatima avatar

    Posted on Jul 30, 2007 (permalink)

    I am trying to do this as well, but my entire page is "AJAX-ified", so tehre are no postbacks.  Can I still open a radalert from my code-behind using AJAX?

  • Georgi Tunev Georgi Tunev admin's avatar

    Posted on Jul 31, 2007 (permalink)

    Hello Fatima,

    I've attached to this thread a small sample that shows one way to do this. If it doesn't fit your scenario, it will be best if you provide more information about your exact set-up.




    Regards,
    Georgi Tunev
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
    Attached files

  • Eva avatar

    Posted on Nov 7, 2007 (permalink)

    Hi,
    I had the same problem when i try open RadWindow in server side using following code.

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim newwidow As New RadWindow
                newwidow.NavigateUrl = "Test.aspx"
                RadWindowManager1.Windows.Add(newwidow)
    end sub

    RadWindow is not opened .Any idea?


  • Hulky avatar

    Posted on Nov 7, 2007 (permalink)

    You also need to set visibleonpageload=true , otherwise you will simply add a new window in the manager's collection.




    Cheers

  • Vinayak Chitre avatar

    Posted on Oct 7, 2009 (permalink)

    I think the alternative syntax

    RadWindow firstWindow = WindowManager.Windows["RadWindow2"];

    is not working in new release Telerik controls.

    Regards,
    vinayak.,

  • Cads avatar

    Posted on Nov 9, 2009 (permalink)

    Hello Georgi,

     

    In reference to your statement "... set its VisableOnPageLoad property to true. This way the RadWindow will be shown after postback." Does this conflict with the DestroyOnClose function?

    Cause I'm currently using the same set up here but when i close the Radwindow, it reappears after postback even when I set the DestroyOnClose property to true.

  • Georgi Tunev Georgi Tunev admin's avatar

    Posted on Nov 10, 2009 (permalink)

    Hello Cads,

    I believe the following excerpt from Changes and Backward Compatibility will be of help:

    When a RadWindow is declared in  RadWindowManager it preserves its ViewState which was not so in previous versions. This could lead to backwards incompatibility when the VisibleOnPageLoad property is used in this configuration with the idea to show the RadWindow only once. Possible solutions for this case are the following ones:
    • Set EnableViewState = "false" for the RadWindowManager
    • Reset the VisibleOnPageLoad property to false with code when suitable, depending on the particular scenario
    • Show the RadWindow through registering a script from the server instead.


    Best wishes,
    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.

  • Pierre-Luc avatar

    Posted on Nov 16, 2009 (permalink)

    Hello Georgi,
    In reference to the previous post.

    We currently use a RadGrid inside with a RadScriptManager and a RadAjaxPanel to display volumes of orders.

    RadGrid
    datasource need 2 RadDatePicker and a RadComboBox that are AutoPostBack="true" 

    When a Row is clicked the ID is return to a RadGrid_OnRowClick server side function that processes the value against another database and create a URL to pass to the RadWindow  so it can extract the value and create/display a related chart using RadChart.

    Users compare a lot of these charts together so we also created a docking section on the webpage and everyone is happy except for one thing!

    As soon as an AutoPostBack="true" control is clicked, any previously closed RadWindow  reappears after PostBack.  We only want the not closed RadWindow  to appear, maintaining their Pre-PostBack position (witch currenly works).

    If tried a bunch of value combinaison with VisibleOnPageLoad,

    DestroyOnClose and EnableViewState.

     


    Any advise?

  • Georgi Tunev Georgi Tunev admin's avatar

    Posted on Nov 17, 2009 (permalink)

    Hi Ian,

    Please open a support ticket and send us a sample project (make sure that it can be run locally) that reproduces your exact setup and the problem that you currently experience. This way we will be able to work directly with your code and logic and we will do our best to provide you with a solution.


    Regards,
    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.

  • Mattias Brage avatar

    Posted on Nov 24, 2009 (permalink)

    Anyone got any ideas on how to get a reference to a window by using its ID?

    Nevermind I found (the obvious) solution:

    foreach( RadWindow w in WindowsManager.Windows) 
          { 
               if (w.ID == this._windowName) 
               { 
                    this._window = w; 
                    break; 
               } 
          } 

  • Georgi Tunev Georgi Tunev admin's avatar

    Posted on Nov 25, 2009 (permalink)

    Hi Mattias,

    I would suggest to use the get_name() method instead. _name is a private property and I would not recommend to use it.



    Best wishes,
    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.

  • Smiely Intermediate avatar

    Posted on Dec 1, 2010 (permalink)

    I have a RadGrid with a button column. On click on that button, I want to pass a value to another .aspx and display the result in Window.

      if (e.CommandName == "viewQuals")
                {
                    GridDataItem item = (GridDataItem)e.Item;
                    int id = int.Parse(item["EIDColumn"].Text);
                    Response.Redirect("~/CrewManagerNew/RES_MQ_new.aspx?empid=" + id);
    }
    Other .aspx is

    protected void Page_Load(object sender, EventArgs e)
            {
                try
                {
        
                    string eid = Request.QueryString["empid"].ToString();
                    string sabdata = myDAL.GetEmployeeQuals(eid, myUser.Aironame); ;
                    qualificationLabel.Text = sabdata;
                }
    This is working BUT I need to display it in window.
    Help...

  • Smiely Intermediate avatar

    Posted on Dec 1, 2010 (permalink)

    Got it worked with javascript...

  • Neerav avatar

    Posted on Dec 9, 2010 (permalink)

    Hello everyone,
    Attached are the screenshots of what is actually required.

    We have  a "Course/Group Courses" tab page as given in figure 1 of attached screen shot.

    Another tab "Hierarchy/Attributes" tab as given in figure 2 of attached screen shot.

    In figure 2 in "User Hierarchy" tree view I have checked "n,k" which is part of "Test" group, and  in figure 1 I have selected "Test1" from "Course Groups" tree view and there are two courses in "Selected Courses" grid.

    Now in figure 1 you can see there is a "Make Assignment" button which on click displays figure 3 as a new window with a filled radgrid.
    The grid in figure 3 has "Assign To" and "Assign Content" and various other columns.
    The "Assign To" column is  hyperlink with data same as node selected in figure 2 i.e. "Test". I think this is a template column.
    As well as "Assign Content" has values from "Course Groups" and "Selected Courses".
    I want to know as to how to create this grid as shown in figure 3.

    Since I cannot fire select query because all items are coming dynamically, can you let me know how to create the radgrid as shown in figure 3.

    For implementing the current requirement in our prototype, I have used following link
    http://www.telerik.com/help/aspnet-ajax/grdbindingtonullableobjects.html, by which I think I would be able to retrieve data from treeview and grid and create datasource as arraylist for figure3 radgrid. Am I going correct?
    My figure 3 radgrid is declared in aspx page.

    Kindly Reply
    Thanks and Regards

  • Xio avatar

    Posted on Jun 6, 2011 (permalink)

    VB.NET:

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
                Singleton.Windows(0).NavigateUrl = "yourpage.aspx"
                Singleton.Windows(0).VisibleOnPageLoad = "true"
    end sub

    ASPX:

    <telerik:RadWindowManager ID="Singleton" runat="server" Behavior="Default" InitialBehavior="None">
    <Windows>
          <telerik:RadWindow ID="DialogWindow" Behaviors="Close" VisibleStatusbar="false"  
               ReloadOnShow="true"  Modal="true" runat="server" Height="800px" Width="600px" VisibleOnPageLoad="false" >
          </telerik:RadWindow>
    </Windows>
    </telerik:RadWindowManager>


    Xiomara P.

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Window > opening a radwindow from code-behind