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

Session lost while opening Rad/Modal window from Another Rad/Modal window

7 Answers 298 Views
Window
This is a migrated thread and some comments may be shown as answers.
Archana
Top achievements
Rank 1
Archana asked on 10 Aug 2011, 09:50 PM
Hi,

In my application I want to open a Rad/Modal window from normal aspx page. This works fine and I can even get the Session.
But when I open another Rad/Modal window from the this new Rad/Modal window it starts a new Session.
I'm using same code to open both windows thats given below:

 

 

function ShowRadForm(ID) {
  
window.radopen("../RadWin1.aspx?ID=" + ID, "radDialog");
  
return false;
  
}
  
  
  
<telerik:RadWindowManager ID="RadWindowManager1" runat="server" AutoSize="true">
  
  
<Windows>
  
  
<telerik:RadWindow ID="radDialog" runat="server" Title="Edit"
  
  
Height="550px" Width="900px" ReloadOnShow="true" ShowContentDuringLoad="false"
  
  
OnClientClose="OnClientClose" Modal="true" Style="z-index: 7001" />
  
  
</Windows>
  
  
</telerik:RadWindowManager>

How can I get Session in radDialog?

 

7 Answers, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 11 Aug 2011, 02:43 PM
Hi Archana,

The Session object is a server-side object and there is no way to retrieve it on the client, except for populating a hidden fiels/label/textbox/etc server control with the desired value on the server. As for a new session being created when you open a RadWindow - this is controlled by the framework and we have no control over it. If the user has been idle long enough and requests a new page (i.e. opens it in a RadWindow or in a browser window) a new session will be created. Please examine the following MSDN articles for more information on the subject:
http://msdn.microsoft.com/en-us/library/ms178581.aspx
http://msdn.microsoft.com/en-us/library/ms524319(v=vs.90).aspx
http://msdn.microsoft.com/en-us/library/ms972429.aspx
http://msdn.microsoft.com/en-us/magazine/cc301579.aspx


Kind regards,
Marin
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Archana
Top achievements
Rank 1
answered on 11 Aug 2011, 11:43 PM
When I searched for it I found solution in following link:

http://support.microsoft.com/kb/831678

But how can we apply it to RadWindow?


0
Marin Bratanov
Telerik team
answered on 16 Aug 2011, 11:14 AM
Hello Archana,

The scenario described in this link is related to the built-in browser dialogs and explains the case where a new system process is started for the new browser window. The RadWIndow, however, is actually a server control, thus it "lives" in the ASPX page only, i.e. it is limited to its own browser window/tab and cannot run another process.

  What I can advise at this point is that you either discover some way of checking for session integrity (or simply extend the session by using simple callbacks through a large enough interval to keep the session alive) in different pages loaded in iframes (as this is actually what the RadWindow is), or use regular browser windows/dialogs if you can work around your issue with them.


Best wishes,
Marin
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Jeffrey
Top achievements
Rank 1
answered on 20 Nov 2019, 01:37 PM
I have a different issue. When I open a Rad/Modal window from normal aspx page I lose the session stqte from the aspx page. Any suggestions?
0
Rumen
Telerik team
answered on 25 Nov 2019, 12:30 PM

Hi Jeffrey,

As explained by Marin, RadWindow does not alter or resets the session. 

Can you please provide more information :

  • A live URL or a sample reproduction project
  • What are the steps to reproduce the issue
  • Are there any errors (JS or server ones)?
  • How RadWindow is configured: does it use ContentTemplate or NavigateUrl?
  • Is it possible that the session has expired and the RadWindows iframe navigates your users to the logic page?

    If this is the case,  you can use a RadAjaxPanel control and its API in order to achieve the desired result. These are the exact steps:
    • Add a RadAjaxPanel and attach a handler to its OnAjaxRequest event:

      <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" OnAjaxRequest="RadAjaxPanel1_AjaxRequest">
      </telerik:RadAjaxPanel>

    • In the attached handler refresh the needed Session variables:

      protected void RadAjaxPanel1_AjaxRequest(object sender, Telerik.Web.UI.AjaxRequestEventArgs e)
      {
          // Refresh Session
      }

    • Attach a JavaScript handler to the onclick client-side event handled. The target elemet is the document object. In that handler call the RadAjaxPanel ajaxRequest client-side method:

      <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
          <script type="text/javascript">
              function refreshSession()
              {
                  var ajaxPanel = $find("<%= RadAjaxPanel1.ClientID %>");
                  ajaxPanel.ajaxRequest();
              }
       
              Sys.Application.add_load(function()
              {
                  $addHandler(document, "click", refreshSession);
              });
          </script>
      </telerik:RadCodeBlock>

      The provided code should be added in the page that is opened in RadWindow. The code ensures that the Session will be refreshed every time when the user clicks somewhere on the page.

 

Best Regards,
Rumen
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Jeffrey
Top achievements
Rank 1
answered on 26 Nov 2019, 01:52 PM

1. I set a session variable in Form1.aspx:
Session["MyExternalUsersOnly"] = DataTable

2. Here is my RadWindow that I call in Form1.aspx:
<telerik:RadWindowManager ID="RadWindowManager1" runat="server" EnableShadow="true">
        <Windows>
            <telerik:RadWindow ID="UserListDialog" runat="server" Title="External User Details"
                Height="550px" Width="500px" Left="150px" ReloadOnShow="true" ShowContentDuringLoad="false"
                AutoSize="false" BackColor="White" Modal="true" />
        </Windows>
    </telerik:RadWindowManager>

3. Here is the java code that gets fired on button click event on Form1.aspx to launch Form2.aspx:
function ShowDetailsForm(id, rowIndex) {
                var grid = $find("<%= RadGridExternalUsers.ClientID %>");
                var rowControl = grid.get_masterTableView().get_dataItems()[rowIndex].get_element();
                grid.get_masterTableView().selectItem(rowControl, true);
                window.radopen("Form2.aspx?Id=" + id, "UserListDialog", outerWidth = "500px", outerHeight= "500px");
                return false;

4. When I close form2.aspx and try to reference Session["MyExternalUsersOnly"] in code behind on Form1.aspx
it returns null




0
Rumen
Telerik team
answered on 29 Nov 2019, 11:50 AM

Hi Jeffrey,

Can you please test the same scenario with a standard iframe HTML element as explained in the General Troubleshooting article? This will show whether the problem is related to RadWindow or not (since you will be able to or not reproduce it with an iframe instead of iframe based RadWindow).


We also noticed that wrong arguments are passed to radopen. Please see this article for more information: Using radopen and GetRadWindowManager().open.

It is likely that Form2 does something to reset the session variable, not the RadWindow. Or, it may be code on Form1 that resets the variable, we don't know when and how they execute those snippets. To investigate this further, please open a support ticket and provide a runnable sample which demonstrates the problem.

Best Regards,
Rumen
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Window
Asked by
Archana
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Archana
Top achievements
Rank 1
Jeffrey
Top achievements
Rank 1
Rumen
Telerik team
Share this question
or