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

redirect after close

1 Answer 35 Views
Window
This is a migrated thread and some comments may be shown as answers.
L
Top achievements
Rank 1
L asked on 09 Dec 2009, 03:45 PM
hi

I have this problem where the code behind was not executed because of the redirection: I want my code behind to be executed before redirection. But it seems that it gets redirected before it can execute the codebehind code. How do i solve this? Thanks

ASPX:
  <script type="text/javascript">
      function close()
      {
          self.close();
      }   
 
        function GetRadWindow()
        {
            var oWindow = null;
            if (window.radWindow) oWindow = window.radWindow;
            else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
            return oWindow;
        }
       
        function closeWin()
            {
            var oWnd = GetRadWindow();
            //top.location.href = 'http://localhost/demo/default.aspx';
            oWnd.close();
           
            }
          </script>
    <td align="center">
                    <asp:Button ID="btnDone" runat="server" onclientclick="closeWin()" CssClass="RadMenu_Black"
                        Font-Bold="True" ForeColor="#333333" Text="Done" />

Code Behind:
  Protected Sub btnDone_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnDone.Click
        MethodA(session("x"))
       MethodB(Session("x"))
    End Sub

1 Answer, 1 is accepted

Sort by
0
Accepted
Schlurk
Top achievements
Rank 2
answered on 09 Dec 2009, 06:34 PM
All client-side scripts will be executed before server-side scripts are, so you should either figure out a way to do what you are doing on the server-side through client-side, or the other way around. Doing this purely in one side or the other would simplify things quite a bit :)
Tags
Window
Asked by
L
Top achievements
Rank 1
Answers by
Schlurk
Top achievements
Rank 2
Share this question
or