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

Keep RadWindow open untill all processes have run?

2 Answers 54 Views
Window
This is a migrated thread and some comments may be shown as answers.
Admin
Top achievements
Rank 1
Admin asked on 06 Sep 2008, 10:13 AM
If I submit ->  update ->  then click the X in the radpanel everything works fine.  The radpanel on client close event fires and then the update panel updates.  Works great!

function OnClientclose(radWindow)
{

var
refreshCalendar = document.getElementById('ctl00_ContentPlaceHolder1_Button1'); refreshCalendar.click();
}

protected void btnRefreshCalendar_Click(object sender, EventArgs e)
 { 
//reload dataset here;
updatePanel.Update();
}


The problem occurs when I am trying to do an insert to the database in the radpanel and then automatically close it.  I dont want the user to have to manually close the window.

btnSubmit1.Attributes.Add("onclick", "CloseRadWindow()");

When I try to attach some javascript to the radwindow to close the window I have found a strange order of procedures that maybe someone else can understand.   What happens is that the window closes,  the update panel refreshes and then the database updates.  I have even verified this in the profiler.  So the problem is that the update panel refreshes but the database hasnt updated yet.    Is there any other way to do this besides trying to inject the code directly without refreshing the updatepanel?  Somehow delay the closing of the radwindow untill it has ran the update function?

Thanks for your time.



function GetRadWindow()
{
var oWindow = null;

if (window.radWindow)
oWindow = window.radWindow;

else if (window.frameElement.radWindow)
oWindow = window.frameElement.radWindow;

return oWindow;
}

function CloseRadWindow()
{
var oWindow = GetRadWindow();

oWindow.Close();
}



2 Answers, 1 is accepted

Sort by
0
Accepted
Georgi Tunev
Telerik team
answered on 08 Sep 2008, 07:15 AM
Hi Mike,

In such case I would suggest to call the JavaScript for closing the RadWindow after the processing on the server has finished - e.g. after the database is updated. You can check the following KB article that shows how to call JavaScript code from the server in different scenarios - it is for radalert() but the logic stays the same:

http://www.telerik.com/support/kb/article/b454K-gtd-b454T-cec-b454c-cec.aspx



Best wishes,
Georgi Tunev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Admin
Top achievements
Rank 1
answered on 08 Sep 2008, 07:34 AM

 Hello Georgi,

The code in the link you mentioned worked perfectly.

Thank you!

 

 

 

 

 

 

 

 

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