Access timer from radwindow

6 posts, 0 answers
  1. Linda
    Linda avatar
    4 posts
    Member since:
    Sep 2010

    Posted 11 Oct 2010 Link to this post

    Hi,

    I have a radwindow that I am using to edit items in a radgrid (loaded using the javascript GetWindow() from the examples). This radgrid is in a usercontrol and is loaded dynamically in the main page. The main page controls (including this usercontrol) is then connected to a timer that refreshes the page every 60 seconds using ajax manager (timer is set as the main control and the user control is set as the updated control)
    Problem is, when the refresh happens, the radwindow is cleared away and from then on will not load or display on the page.

    I have tried various ways to get this working using one that I thought should work was putting in a javascript function to get the client ID in the main page and calling this function from the user control (which does return the timer control) and then setting the disabled property to false. Issue with this is, I get the control fine, set it to disabled but still the timer is ticking away and continues to refresh. 
    I have been working on this issue for a couple of days now and would really appreciate a quick response. 

    Many thanks!
    Linda
  2. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 12 Oct 2010 Link to this post

    Hi Linda,

    If I understand your scenario correctly, you have a JavaScript function on the main page that should control the timer and you call that function from within the content page (I assume you are using GetRadWindow().BrowserWindow.calledFunction()) and this is not working as expected. If this is so, what happens if you call the function on the main page directly - e.g. by clicking a button on the same page?

    If this is not your case, please provide some more details about your setup and code samples that would allow us to get a better view over your scenario.

    Kind regards,
    Georgi Tunev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Linda
    Linda avatar
    4 posts
    Member since:
    Sep 2010

    Posted 12 Oct 2010 Link to this post

    I have this timer in the main page.This timer controls refreshing of this main page. I have this ajax setting in the main page. this timer controls refreshes the content of this main page. The user control is loaded in the tab strip. the user control has a rad window in it to edit the form. The radwindow is opened using GetWindow() in javascript.
    Problem is when the ontick event gets called and the radwindow is open, it disappears. I need to access the timer from the usercontrol and disable it in the openwindow/client activate javascript function. and in the client close re-enable the timer.
    Thanks. 

     

     

    <asp:Timer ID="hello" runat="server" OnTick="hello_Tick" Interval="20000" Enabled="true"
    </asp:Timer
    <telerik:AjaxSetting AjaxControlID="hello" >
    <UpdatedControls
    <telerik:AjaxUpdatedControl ControlID="tabstrip" /> 
    </UpdatedControls
    </telerik:AjaxSetting>
    function OpenWindow(id, rowIndex) { 
    var gridView = $find("<%= gridView.ClientID %>"); 
    var rowControl = gridView.get_detailTables()[1].get_dataItems()[rowIndex].get_element(); 
    gridView.get_detailTables()[1].selectItem(rowControl, 
    true); 
    window.radopen(
    "EditForm.aspx?hello=" + id, "UserListDialog"); 
    return false; 
    }
      
  4. Linda
    Linda avatar
    4 posts
    Member since:
    Sep 2010

    Posted 12 Oct 2010 Link to this post

    Do you understand the scenario?? Any suggestions as to how I can get this working?
  5. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 13 Oct 2010 Link to this post

    Hello Linda,

    So the user control (with the RadWindow in it) is on the same page where the timer is, right? If so, the easiest way to disable the timer is to use its client-side API and stop it when you show the RadWindow. After that, you could hook to the ClientClose event of the RadWindow object and to start the timer again when the RadWindow is closed.
    Please check the attached sample. In it, the first button opens a RadWindow without affecting the timer - which is the scenario I assume you have. The second button uses the logic that I suggested above and the window remains open on the page.


    All the best,
    Georgi Tunev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  6. Linda
    Linda avatar
    4 posts
    Member since:
    Sep 2010

    Posted 14 Oct 2010 Link to this post

    Thanks for this. Worked like a charm.
Back to Top