Hi,
In MainPage.aspx, when I click the button Upload in ParentTab2, it will pop up a Rad Window(rdwUpload-Upload.aspx).
Then, I selected the picture and click the button Upload, it will uploaded the photo.
So, when I click the close button of the Rad Window, I want to refresh the data list (dtlPhoto) in MainPage.aspx but it seems did'nt refresh the datalist. I don't want the whole page being refresh, just wana refresh the data list in pgViewTab.
I'm using OnClientClose in RadWindow.
May I know how to do this? Thanks.
Regards,
Jessie
In MainPage.aspx, when I click the button Upload in ParentTab2, it will pop up a Rad Window(rdwUpload-Upload.aspx).
Then, I selected the picture and click the button Upload, it will uploaded the photo.
So, when I click the close button of the Rad Window, I want to refresh the data list (dtlPhoto) in MainPage.aspx but it seems did'nt refresh the datalist. I don't want the whole page being refresh, just wana refresh the data list in pgViewTab.
I'm using OnClientClose in RadWindow.
May I know how to do this? Thanks.
(1) MainPage.aspx |
================== |
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="TestingTab.aspx.cs" Inherits="TestingTab" %> |
<%@ 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></title> |
</head> |
<body> |
<form id="form1" runat="server"> |
<telerik:RadScriptManager ID="RadScriptManager1" runat="server"> |
</telerik:RadScriptManager> |
<div> |
<telerik:RadTabStrip ID="rtsTab" runat="server" MultiPageID="rmpTab" ScrollChildren="true"> |
<Tabs> |
<telerik:RadTab Text="ParentTab1" runat="server" Selected="true"> |
<Tabs> |
<telerik:RadTab Text="ChildTab1" PageViewID="pgView1" Selected="true"> |
</telerik:RadTab> |
<telerik:RadTab Text="ChildTab2" PageViewID="pgView2"> |
</telerik:RadTab> |
</Tabs> |
</telerik:RadTab> |
<telerik:RadTab Text="ParentTab2" runat="server" PageViewID="pgViewTab" |
</telerik:RadTab> |
</Tabs> |
</telerik:RadTabStrip> |
<telerik:RadMultiPage ID="rmpTab" runat="server"> |
<telerik:RadPageView ID="pgView1" runat="server" Selected="true"> |
ParentTab1, ChildTab1 |
</telerik:RadPageView> |
<telerik:RadPageView ID="pgView2" runat="server"> |
ParentTab1, ChildTab2 |
</telerik:RadPageView> |
<telerik:RadPageView ID="pgViewTab" runat="server"> |
ParentTab2 |
<button style="width: 70px;" onclick="openRadWin(); return false;">Upload</button> |
<asp:DataList ID="dtlPhoto" runat="server" DataSourceID="odsPhoto"> |
<ItemTemplate> |
<img id="img" alt="" src='<%# Eval("ImageLocation") %>' /> |
</ItemTemplate> |
</asp:DataList> |
</telerik:RadPageView> |
</telerik:RadMultiPage> |
<telerik:RadAjaxManager runat="server" ID="RadAjaxManager1" OnAjaxRequest="RadAjaxManager1_AjaxRequest"> |
<AjaxSettings> |
<telerik:AjaxSetting AjaxControlID="rtsTab"> |
<UpdatedControls> |
<telerik:AjaxUpdatedControl ControlID="rtsTab" /> |
<telerik:AjaxUpdatedControl ControlID="rmpTab" /> |
</UpdatedControls> |
</telerik:AjaxSetting> |
<telerik:AjaxSetting AjaxControlID="RadAjaxManager1"> |
<UpdatedControls> |
<telerik:AjaxUpdatedControl ControlID="dtlPhoto" /> |
</UpdatedControls> |
</telerik:AjaxSetting> |
</AjaxSettings> |
</telerik:RadAjaxManager> |
</div> |
</form> |
<telerik:RadWindowManager ID="RadWindowManager1" runat="server"> |
<Windows> |
<telerik:RadWindow |
id="rdwUpload" |
runat="server" |
showcontentduringload="false" |
width="400px" |
height="200px" |
title="Upload Photo" |
behaviors="Pin,Close,Move" |
Modal="true" OnClientClose="refreshDataList"> |
</telerik:RadWindow> |
</Windows> |
</telerik:RadWindowManager> |
<script type="text/javascript"> |
function OnClientTabSelected(sender, args) { |
var tab = args.get_tab(); |
if (tab.get_tabs().get_count() != 0) { |
tab.get_tabs().getTab(0).click(); |
} |
} |
function openRadWin() { |
radopen("http://localhost/Testing/Upload.aspx", "rdwUpload"); |
} |
function refreshDataList(arg) { |
if (!arg) { |
$find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Rebind"); |
} |
} |
</script> |
</body> |
</html> |
(2) MainPage.aspx.cs |
==================== |
protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e) |
{ |
if (e.Argument == "Rebind") |
{ |
dtlPhoto.DataBind(); |
} |
} |
(3) Upload.aspx |
=============== |
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Upload.aspx.cs" Inherits="Upload" %> |
<%@ 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"> |
<script type="text/javascript"> |
function CloseAndRebind(args) { |
GetRadWindow().Close(); |
GetRadWindow().BrowserWindow.refreshDataList(args); |
} |
function GetRadWindow() { |
var oWindow = null; |
if (window.radWindow) oWindow = window.radWindow; //Will work in Moz in all cases, including clasic dialog |
else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow; //IE (and Moz as well) |
return oWindow; |
} |
function returnToParent() { |
//get a reference to the current RadWindow |
var oWnd = GetRadWindow(); |
} |
function RefreshParentPage() { |
GetRadWindow().BrowserWindow.location.href = GetRadWindow().BrowserWindow.location.href; |
} |
</script> |
</head> |
<body> |
<form id="form1" runat="server"> |
<div> |
<telerik:RadScriptManager ID="RadScriptManager1" runat="server"> |
</telerik:RadScriptManager> |
<table border="0" width="100%" cellpadding="5" cellspacing="0"> |
<tr> |
<td> |
<telerik:RadUpload ID="uplPhoto" runat="server" ControlObjectsVisibility="None" MaxFileInputsCount="1" Width="300px" |
allowedfileextensions=".jpg,.jpeg,.gif,.png,.bmp"> |
</telerik:RadUpload> |
<asp:Button ID="btnUpload" runat="server" Text="Upload" onclick="btnUpload_Click" /> |
</td> |
</tr> |
</table> |
</div> |
</form> |
</body> |
</html> |
Regards,
Jessie