After I close a radwindow can I change the parent window URL?

8 posts, 0 answers
  1. matt
    matt avatar
    75 posts
    Member since:
    May 2008

    Posted 16 Jul 2008 Link to this post

    I have a radwindow with some links to different things. I want to be able to click on a link and then have the radwindow close (got this part working)

    and then in the parent page I want a code behind method to be called so I can look at the value sent back from the RadWindow and Response.Redirect to certain URL.

    Is this possible?

    I looked on the forum here already and didnt see anything regarding this issue. help

  2. matt
    matt avatar
    75 posts
    Member since:
    May 2008

    Posted 16 Jul 2008 Link to this post

    http://www.telerik.com/DEMOS/ASPNET/Prometheus/Controls/Examples/Integration/GridAndWindow/DefaultCS.aspx?product=grid

    and I looked there

    all I want is after I click a linkbutton in the radwindow someway to get in the codebehind of the parent page so I can do a response.redirect and what I need to do

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 17 Jul 2008 Link to this post

    Hi matt,

    I would suggest to check the Using RadWindow as a Dialog topic in the documentation - there you can see how to return arguments from the dialog on the parent page.
    Sending these arguments from the client to the server is out of the scope of the RadWindow control - this is a general ASP.NET task. You can find more information on how to call a server-side function via Javascript in various places in the Net (the asp.net forums are a good place to start). For example you can use __doPostBack() or RadAjax's ajaxRequest call to do this.


    Sincerely yours,
    Georgi Tunev
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  5. matt
    matt avatar
    75 posts
    Member since:
    May 2008

    Posted 17 Jul 2008 Link to this post

    I understand the 2 parts you mention.

    Part 1 is passing the variables back and forth in Javascript from the popup back to the parent. I see some good examples

    Part 2 is I think I need to call the javascript doPostback so it will go back to the server and I suppose there is some way to pass a javascript variable to the server

    So do I have the basic ideas right?

    This seems kind of unusual what I am doing so unfortuntly I cannot find any examples of anyone doing something similiar :(

    I posted on asp.net . Hopefully that will help
  6. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 18 Jul 2008 Link to this post

    Hello Matt,

    Yes, you got the idea right. As for sending arguments to the server with __doPostback() (note the 2 underscores in front), I suggest to check the following article:
    http://aspalliance.com/895_Understanding_the_JavaScript___doPostBack_Function.all
    which offers a very good explanation on the logic that should be used.



    Best of luck,
    Georgi Tunev
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  7. matt
    matt avatar
    75 posts
    Member since:
    May 2008

    Posted 18 Jul 2008 Link to this post

    I foudn another article that mentioned a way that seemed easier.. How about using

    <asp:LinkButton ID="lb" runat="server" OnClientClick="OpenSelfClosingRadWindow();return false;" Text="Alerts and Announcements" />

    to open a window then using

    <asp:Button OnClick="Button1_Click" Runat="server" Text="Postback page and close on reload" id="Button1"></asp:Button>

    <

    asp:Label ID="lblScript" Runat="server"></asp:Label>

    and

    protected void Button1_Click(object sender, System.EventArgs e)

    {

    lblScript.Text =

    "<script>CloseOnReload()</" + "script>";

    }

    That works great.

    but then the problem with that is I am using a collection of linkbuttons and NOT just one button. so I capture the onClick for the link clicked and say

    lblScript.Text =

    "<script>CloseOnReload()</" + "script>";

    and that DOES NOT work

    Any idea why? Using those javascrpit functions seemed easier that onpostback

    and about onpostback how do I get back to the calling pages javascript?

  8. Shaun Peet
    Shaun Peet avatar
    571 posts
    Member since:
    Aug 2004

    Posted 19 Jul 2008 Link to this post

    To use the calling page's code...

    Say the parent page has a js function like so:

    function doSomething() { alert('Hello!); }

    The window's page needs to get a reference to the window object, and then use the BrowserWindow object to get the parent page, which is then used to call the function on the parent page.  So, the window page needs to have the following script:

    function get_RadWindow() {   
      var oWindow = null;   
      if (window.radWindow) {   
       oWindow = window.radWindow;   
      }   
      else if (window.frameElement.radWindow) {   
        oWindow = window.frameElement.radWindow;   
      }   
      return oWindow;   
    }  
     
    function callParentAndClose {  
      get_RadWindow().BrowserWindow.doSomething();  
      get_RadWindow().Close();  

    Hope that helps,

    Shaun.

  9. Shaun Peet
    Shaun Peet avatar
    571 posts
    Member since:
    Aug 2004

    Posted 19 Jul 2008 Link to this post

    By the way, I would also suggest that you do the following...

    Add a RadAjaxManager to the page that is opened by the window, and add the buttons (or linkbuttons) to the collection of controls that are ajaxified by the RadAjaxManager.  Then, you can use the server-side event for the buttons / linkbuttons to execute client-side code after a click happens.  So, you'll end up with:

    Protected Sub Button1_Click(object sender, System.EventArgs e) {
      RadAjaxManager1.ResponseScripts.Add("CloseOnReload()");
    }

    I think you'll find that this is extremely fast and will get rid of any screen flicker caused by your postback, and it's also quite easy to do.  Hope that helps,

    Shaun.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017