Hi,
I am using RadWindow to show details of an item. I have image on parent page and using onclick I call the javascript function below. Image is added to the page in code behind like this:
sb.Append(string.Format("<img title=\"Details\" src=\"images/details.png\" onclick=\"ShowWindow('SessionDetails.aspx?id={0}');return false;\"/> ", pid));
var oldUrl;
function ShowWindow(url) {
var oWnd = $find("<%=rwDialog.ClientID%>");
oWnd.setUrl(url);
oWnd.setSize(750, 480);
oWnd.show();
if (oldUrl == url) {
oWnd.reload();
}
oldUrl = url;
}
If I click on image to see details, it works fine. Now if I click on the same item again (without clicking any other item), it show window with the same page but without post back. Thats why I used oldUrl in script above. If page is different from last click, it only sets the url. But I used clicked on the same item, reload will give them fresh page. Problem is that that it gives browser message that page will reload.
Another thing I noticed is that it happens only if I use a close button in my child page. If I use RadWindow's default close button to close the window, I dont get that reload warning. Any ideas how can i avoid that reload message?
This is how I close child window
private void CloseWithoutParentRefresh()
{
string script = string.Format("<script>CloseOnReload()</" + "script>");
ClientScript.RegisterStartupScript(this.GetType(), "CloseOnReload", script);
}
//GetRadWindow obtains a reference to the hosting RadWindow"
function GetRadWindow() {
var oWindow = null;
if (window.radWindow)
oWindow = window.radWindow;
else if (window.frameElement.radWindow)
oWindow = window.frameElement.radWindow;
return oWindow;
}
function CloseOnReload(url) {
GetRadWindow().close();
}