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

Client-side radopen Function and Postbacks

6 Answers 242 Views
Window
This is a migrated thread and some comments may be shown as answers.
Jason Richmeier
Top achievements
Rank 1
Jason Richmeier asked on 03 Sep 2009, 02:01 PM
Is it possible to call the radopen function without causing a postback?

Here is what I am trying to do.

I am trying to use a modal RadWindow to inform the user that their (forms authentication) session is about to expire.  When I display the RadWindow using the radopen function, a postback occurs and the session expiration is reset (which causes the information in the popup window to become inaccurate).

Is there a better way to accomplish what I am trying to do or will the RadWindow not work in a scenario such as this.

Thank you,

Jason Richmeier

6 Answers, 1 is accepted

Sort by
0
Fiko
Telerik team
answered on 04 Sep 2009, 01:58 PM
Hi Jason,

The RadWindow control is designed to work with client-side script and you can achieve the desired result by using this approach :

<asp:Button ID="Button1" Text="Open RadWindow"
runat="server"
OnClientClick
="openRadWindow();return false;" />

<script language="javascript" type="text/javascript"
    function openRadWindow(oWindow, args) 
    { 
        // Open a new window; 
        var oWnd = radopen("http://www.telerik.com", "RadWindow2"); 
    } 
</script> 

The return false statement avoids the postback in the code.

I hope this helps.

Regards,
Fiko
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.
0
Jason Richmeier
Top achievements
Rank 1
answered on 04 Sep 2009, 02:08 PM
I understand your response.  However, the radopen function is not being called after a button is clicked (as in the sample code you provided).  It is being called in a client-side script function that is responding to a timer event.

For example, I have code such as the following:

<script type="text/javascript">
  function Timer_Expired()
  {
    radopen('URL to display in RadWindow', 'ID of RadWindow');

    return;
  }

  function Body_Load()
  {
    window.setTimeout('Timer_Expired();', numberOfMilliseconds);

    return;
  }
</script>

Of course, the function Body_Load is used as the value of the onload attribute of the body element.

When the radopen function is called, it causes the page hosting the RadWindow control to reload (a postback occurs).

Please let me know if you require additional information.

Thank you,

Jason Richmeier
0
Fiko
Telerik team
answered on 04 Sep 2009, 02:44 PM
Hello Jason,

The problem comes from the fact that the MS AJAX framework is not rendered on the page. Our controls are build upon that framework and the RadWindowManager (radopen requires this control on the page) is rendered in a later stage in the page live cycle. In this case you need to use this approach :

<script type="text/javascript"
    function Timer_Expired() 
    { 
        radopen('URL to display in RadWindow''ID of RadWindow'); 
 
        return
    } 
 
    function pageLoad() 
    { 
        window.setTimeout('Timer_Expired();', numberOfMilliseconds); 
 
        return
    } 
</script> 


The pageLoad function is called after the MS AJAX framework is completely loaded on the page and this ensures that the radopen function will work correctly.

In case that the problem still exists, please open a new support ticket and send us a runnable project that reproduces your scenario. We will do our best to provide a working solution as soon as possible.

Best wishes,
Fiko
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.
0
Jason Richmeier
Top achievements
Rank 1
answered on 09 Sep 2009, 02:10 PM
I started to create a sample project.  However, the more I thought about it, I realized that this may not be necessary as the behavior I have described is visible on the samples page on the Telerik web site.

Thank you,

Jason Richmeier
0
Georgi Tunev
Telerik team
answered on 10 Sep 2009, 06:43 AM
Hi Jason,

There is no postback when the client-side API is used. Could you please let me know in which demo you see such behavior and how you determine that there is a postback on the page? If you are talking about the browser's loading bar appearing when a RadWindow is shown, please note  that this is expected - the browser shows that it is loading the content page, but this is not a postback. The easiest way to verify this is to press the F5 key or the Refresh button on your browser - if there was a postback, you would get a warning that POSTDATA will be send again.


Kind 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.
0
Jason Richmeier
Top achievements
Rank 1
answered on 16 Sep 2009, 02:15 PM
It appears that I mistakingly indicated that a postback is performed when opening the RadWindow object with client-side script.  After further testing, I noticed that a postback does not occur.

What was causing the problem is that the page I was using for the RadWindow object was in the same domain as the base page.  When the RadWindow page was requested, a refresh of the authentication cookie was performed which was causing the behavior I described.  I could move the RadWindow page to another domain but perhaps the RadWindow control was not really designed for what I am trying to do.

Thank you,

Jason Richmeier
Tags
Window
Asked by
Jason Richmeier
Top achievements
Rank 1
Answers by
Fiko
Telerik team
Jason Richmeier
Top achievements
Rank 1
Georgi Tunev
Telerik team
Share this question
or