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

Session lost while opening Rad/Modal window from an ASPX Page

8 Answers 600 Views
Window
This is a migrated thread and some comments may be shown as answers.
Jeffrey
Top achievements
Rank 1
Jeffrey asked on 20 Nov 2019, 01:41 PM
When I open a Rad/Modal window from normal aspx page I lose the session stqte from the aspx page. Any suggestions?

8 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 25 Nov 2019, 12:31 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.

 

 

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 27 Nov 2019, 01:34 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
Jeffrey
Top achievements
Rank 1
answered on 27 Nov 2019, 01:37 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, 04:45 PM

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.aspx does something to reset the session variable, not the RadWindow. Or, it may be code on Form1.aspx 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.

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 03 Dec 2019, 05:40 PM

Rumen,

How would I go about replacing the window.radopen call with a call using an iframe?

Thanks,

Jeffrey

0
Rumen
Telerik team
answered on 06 Dec 2019, 03:39 PM

Hi Jeffrey,

RadWindow is based on an <iframe>, it behaves just like one – basically, whatever can be done with an <iframe>, can be achieved with RadWindow as well. This fact is useful when you investigate a reason for some problem related to the RadWindow control. Just replace the RadWindow with a standard <iframe> and see how your application will behave in this case. If the problem still exists, then it is not related to the RadWindow control but is most probably a default browser’s behavior or a problem in the used logic itself.

The content area of RadWindow is a standard iframe element, the idea of the test is to replace RadWindow with an iframe and to load the same content in it. For example load the contents of the Form2.aspx in the iframe loaded by window.open:

var win = window.open();
win.document.write('<iframe width="560" height="315" src="Form2.aspx?Id=" frameborder="0" allowfullscreen></iframe>');



https://stackoverflow.com/questions/20235772/is-it-possible-to-open-a-new-window-and-embed-iframe-in-to-this

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 09 Dec 2019, 06:18 PM

Rumen,

Same result. The session is lost as soon as the windows object is instantiated. So it's not the radwindow..

Jeff.

0
Rumen
Telerik team
answered on 11 Dec 2019, 01:02 PM

Thank you for the update Jeff.

If the problem is generic and not related to RadWindow, it is better to post it at StackOverflow and the MS ASP.NET Forums. There might be somebody else who already experienced it and who can help.

Another option is to comment portions of the code until you find out what is causing the issue.

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
Jeffrey
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Jeffrey
Top achievements
Rank 1
Share this question
or