8 Answers, 1 is accepted
0

Shinu
Top achievements
Rank 2
answered on 09 Sep 2008, 07:48 AM
Hi,
Here is a code library submission which demonstrates the requested functionality. Go through it and see if it is helpful.
Confirm closing of a RadWindow by using radconfirm
Regards
Shinu
Here is a code library submission which demonstrates the requested functionality. Go through it and see if it is helpful.
Confirm closing of a RadWindow by using radconfirm
Regards
Shinu
0

Gernot
Top achievements
Rank 1
answered on 09 Sep 2008, 07:57 AM
Thank you for your help but i already tried out and this is not working for me :-(
I have Version 2008.1.619 of Rad Controls for ASP.Net Ajax.
In this javascript code the CloseButton object is always null !!!
var CloseButton = document.getElementById("CloseButton" + oWnd.Id);
Here is the Code :
function openProduktDetailsWindow(ProduktID,ProduktFamilieID)
{
var oWnd = radopen("<%= HttpContext.Current.Request.ApplicationPath %>/ProduktDetails.aspx?ProduktID=" + ProduktID + "&ProduktFamilieID=" + ProduktFamilieID, "ProduktDetailsRadWindow1");
oWnd.Id = "ProduktDetailsRadWindow1";
oWnd.add_close(OnClientclose);
oWnd.setSize (1000, 800);
oWnd.Center();
ConfirmClose("ProduktDetailsRadWindow1");
}
function ConfirmClose(WinName) {
var oManager = GetRadWindowManager();
var oWnd = oManager.GetWindowByName(WinName);
//Find the Close button on the page and attach to the
//onclick event
var CloseButton = document.getElementById("CloseButton" + oWnd.Id);
CloseButton.onclick = function() {
CurrentWinName = oWnd.Id;
//radconfirm is non-blocking, so you will need to provide a callback function
radconfirm("Blaaa!", confirmCallBackFn);
}
}
function confirmCallBackFn(arg) {
if (arg == true) {
var oManager = GetRadWindowManager();
var oWnd = oManager.GetWindowByName(CurrentWinName);
oWnd.Close();
}
}
I have Version 2008.1.619 of Rad Controls for ASP.Net Ajax.
In this javascript code the CloseButton object is always null !!!
var CloseButton = document.getElementById("CloseButton" + oWnd.Id);
Here is the Code :
function openProduktDetailsWindow(ProduktID,ProduktFamilieID)
{
var oWnd = radopen("<%= HttpContext.Current.Request.ApplicationPath %>/ProduktDetails.aspx?ProduktID=" + ProduktID + "&ProduktFamilieID=" + ProduktFamilieID, "ProduktDetailsRadWindow1");
oWnd.Id = "ProduktDetailsRadWindow1";
oWnd.add_close(OnClientclose);
oWnd.setSize (1000, 800);
oWnd.Center();
ConfirmClose("ProduktDetailsRadWindow1");
}
function ConfirmClose(WinName) {
var oManager = GetRadWindowManager();
var oWnd = oManager.GetWindowByName(WinName);
//Find the Close button on the page and attach to the
//onclick event
var CloseButton = document.getElementById("CloseButton" + oWnd.Id);
CloseButton.onclick = function() {
CurrentWinName = oWnd.Id;
//radconfirm is non-blocking, so you will need to provide a callback function
radconfirm("Blaaa!", confirmCallBackFn);
}
}
function confirmCallBackFn(arg) {
if (arg == true) {
var oManager = GetRadWindowManager();
var oWnd = oManager.GetWindowByName(CurrentWinName);
oWnd.Close();
}
}
0

Gernot
Top achievements
Rank 1
answered on 09 Sep 2008, 08:37 AM
The reason this error accours is that the close button in the window object has no ID.
The property id is empty :-(
I made a screenshot in FireBug:
http://img230.imageshack.us/my.php?image=firebugscreenshotxf2.jpg
Thank you for your Help!
The property id is empty :-(
I made a screenshot in FireBug:
http://img230.imageshack.us/my.php?image=firebugscreenshotxf2.jpg
Thank you for your Help!
0
Hello Alaeddin Gedik,
Indeed, the solution that Shinu posted is for RadWindow for ASP.NET and not for ASP.NET AJAX. In RadWindow for ASP.NET AJAX, you need to override the closing functionality:
Greetings,
Petko
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Indeed, the solution that Shinu posted is for RadWindow for ASP.NET and not for ASP.NET AJAX. In RadWindow for ASP.NET AJAX, you need to override the closing functionality:
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik"%> |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
<html xmlns="http://www.w3.org/1999/xhtml" > |
<head runat="server"> |
<title>Untitled Page</title> |
</head> |
<body> |
<form id="form1" runat="server"> |
<asp:ScriptManager ID="ScriptManager" runat="server"></asp:ScriptManager> |
<div> |
<script type="text/javascript"> |
function openWin() |
{ |
var oWnd = window.radopen("http://www.google.de","test"); |
} |
</script> |
<input type="button" value="OpenWin" runat="server" id="Button1" onclick="openWin()"> |
<telerik:RadWindowManager ID="RadWindowManager1" runat="server"> |
</telerik:RadWindowManager> |
<script type="text/javascript"> |
TelerikTelerik.Web.UI.RadWindow.prototype.oldClose = Telerik.Web.UI.RadWindow.prototype.close; |
Telerik.Web.UI.RadWindow.prototype.close = function() |
{ |
var answer = confirm("Are you sure?"); |
if(answer) |
{ //call the old closing method if needed |
this.oldClose(); |
} |
} |
</script> |
</div> |
</form> |
</body> |
</html> |
Greetings,
Petko
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0

Gernot
Top achievements
Rank 1
answered on 09 Sep 2008, 09:25 AM
Thanky you very much!
This worked with the default confirm dialog but not with radconfirm.
The radconfirm messagebox appears but you cant close it !
Cheers
Alaeddin
This worked with the default confirm dialog but not with radconfirm.
The radconfirm messagebox appears but you cant close it !
Cheers
Alaeddin
0

Gernot
Top achievements
Rank 1
answered on 09 Sep 2008, 10:13 AM
Hello,
with this solution the confirm dialog appears for each radwindow !!!
For example if you have a grid on your page and if you click the delete button in the radgrid, the radconfirm dialog appears. Now if you click "No/Close" the javascript confirm dialog apears ;-) funny
Any solutions?
with this solution the confirm dialog appears for each radwindow !!!
For example if you have a grid on your page and if you click the delete button in the radgrid, the radconfirm dialog appears. Now if you click "No/Close" the javascript confirm dialog apears ;-) funny
Any solutions?
0

Gernot
Top achievements
Rank 1
answered on 09 Sep 2008, 10:47 AM
Sorry i forget to wrote that the confirmdialogtype in the grid must be set to radwindow!
0

Obi-Wan Kenobi
Top achievements
Rank 1
answered on 12 Sep 2008, 10:45 AM
The RadWindow.Close method is overriden, so this is an expected behavior. Keep in mind that RadGrid uses the RadWindow scripts when the confirmdialogtype is RadWindow .
If you want to show the confirm dialog only for a particular window you should write some additional JavaScript, e.g.
If you want to show the confirm dialog only for a particular window you should write some additional JavaScript, e.g.
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik"%> |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
<html xmlns="http://www.w3.org/1999/xhtml" > |
<head id="Head1" runat="server"> |
<title>Untitled Page</title> |
</head> |
<body> |
<form id="form1" runat="server"> |
<asp:ScriptManager ID="ScriptManager" runat="server"></asp:ScriptManager> |
<div> |
<script type="text/javascript"> |
var windowWithConfirm = false; |
function openWinWithConfirm() |
{ |
windowWithConfirm = true; |
var oWnd = window.radopen("http://www.google.de","test"); |
} |
function openWin() |
{ |
var oWnd = window.radopen("http://www.yahoo.com","test"); |
} |
</script> |
<input type="button" value="OpenWinWithConfirm" runat="server" id="Button1" onclick="openWinWithConfirm()"/> |
<input type="button" value="OpenWithoutConfirm" runat="server" id="Button2" onclick="openWin()"/> |
<telerik:RadWindowManager ID="RadWindowManager1" runat="server"> |
</telerik:RadWindowManager> |
<script type="text/javascript"> |
Telerik.Web.UI.RadWindow.prototype.oldClose = Telerik.Web.UI.RadWindow.prototype.close; |
Telerik.Web.UI.RadWindow.prototype.close = function() |
{ |
if(windowWithConfirm == true) |
{ |
var answer = confirm("Are you sure?"); |
if(answer) |
{ |
//call the old closing method if needed |
this.oldClose(); |
windowWithConfirm = false; |
} |
} |
else |
{ |
this.oldClose(); |
} |
} |
</script> |
</div> |
</form> |
</body> |
</html> |