Hello,
I launch the windows from image buttons in a template column in a radgrid (located in a content page that inherits from a masterpage). When I click the cancel buttons on the window and simply close the window, the original settings i specify are maintained. However, when I click a button that does something then executes an ajax request to refresh the underlying grid, every window I open loses the settings I previously defined.
My RadWindowManager/Window setup:
Example Window JavaScript:
Code executed on clicking a cancel button:
Code executed on clicking "accept" button:
JavaScript refresh grid function on content page:
Ajax request code on content page:
Any Ideias?
Thanks in advance.
I launch the windows from image buttons in a template column in a radgrid (located in a content page that inherits from a masterpage). When I click the cancel buttons on the window and simply close the window, the original settings i specify are maintained. However, when I click a button that does something then executes an ajax request to refresh the underlying grid, every window I open loses the settings I previously defined.
My RadWindowManager/Window setup:
<telerik:RadWindowManager ID="RadWindowManager1" runat="server" Behavior="None" |
InitialBehaviors="Pin" KeepInScreenBounds="True" Modal="True" |
PreserveClientState="True" ReloadOnShow="True" ShowContentDuringLoad="False" |
VisibleStatusbar="False"> |
<Windows> |
<telerik:RadWindow Skin="Vista" ID="InsertTaskWindow" runat="server" |
Title="Criar Tarefa" Height="620px" |
Width="750px" Left="" Modal="true" Overlay="True" |
ShowContentDuringLoad="False" Behavior="None" Behaviors="None" |
InitialBehavior="Pin" InitialBehaviors="Pin" ReloadOnShow="True" |
VisibleStatusbar="False" KeepInScreenBounds="True" /> |
<telerik:RadWindow Skin="Vista" ID="EditTaskDialog" runat="server" |
Title="Editar Tarefa" Height="620px" |
Width="750px" Left="" Modal="true" Overlay="True" |
ShowContentDuringLoad="False" Behavior="None" Behaviors="None" |
InitialBehavior="Pin" InitialBehaviors="Pin" ReloadOnShow="True" |
VisibleStatusbar="False" KeepInScreenBounds="True" /> |
<telerik:RadWindow ID="ConfimTaskDialog" runat="server" Behavior="None" |
Title="ConcluĂr Tarefa" |
Behaviors="None" InitialBehavior="Pin" InitialBehaviors="Pin" |
Height="150px" |
Width="300px" VisibleStatusbar="False" |
KeepInScreenBounds="True" Left="" Modal="True" NavigateUrl="" |
ReloadOnShow="True" ShowContentDuringLoad="False" Top="" Skin="Vista"> |
</telerik:RadWindow> |
<telerik:RadWindow ID="ValidateTaskDialog" runat="server" Behavior="None" |
Behaviors="None" Height="150px" |
Width="300px" InitialBehavior="Pin" InitialBehaviors="Pin" |
KeepInScreenBounds="True" Left="" Modal="True" NavigateUrl="" |
ReloadOnShow="True" style="display:none;" Title="Validar Tarefa" Top="" |
VisibleStatusbar="False" ShowContentDuringLoad="False" Skin="Vista"> |
</telerik:RadWindow> |
<telerik:RadWindow ID="ViewTaskNotesDialog" runat="server" Behavior="None" |
Height="400px" |
Width="400px" |
Behaviors="None" InitialBehavior="Pin" InitialBehaviors="Pin" |
KeepInScreenBounds="False" Left="" Modal="True" NavigateUrl="" |
ReloadOnShow="True" ShowContentDuringLoad="False" VisibleStatusbar="False" |
Skin="Vista" |
style="display:none;" Title="Notas sobre Tarefa" Top=""> |
</telerik:RadWindow> |
<telerik:RadWindow ID="DeleteTaskDialog" runat="server" Behavior="None" |
Title="Apagar Tarefa" |
Behaviors="None" InitialBehavior="Pin" InitialBehaviors="Pin" |
Height="150px" Width="300px" |
KeepInScreenBounds="True" Left="" Modal="True" NavigateUrl="" |
ReloadOnShow="True" VisibleStatusbar="False" |
ShowContentDuringLoad="False" Top="" Skin="Vista"> |
</telerik:RadWindow> |
<telerik:RadWindow ID="ViewTaskHistoryWindow" runat="server" Behavior="None" |
Height="550px" |
Width="1150px" |
Behaviors="None" InitialBehavior="Pin" InitialBehaviors="Pin" |
KeepInScreenBounds="True" Left="" Modal="True" NavigateUrl="" |
ReloadOnShow="True" ShowContentDuringLoad="False" style="display:none;" |
Title="HistĂłrico de Tarefas" Top="" VisibleStatusbar="False"> |
</telerik:RadWindow> |
</Windows> |
</telerik:RadWindowManager> |
Example Window JavaScript:
<script type="text/javascript"> |
function CloseAndRebind(args) { |
GetRadWindow().Close(); |
GetRadWindow().BrowserWindow.refreshGrid(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 CancelEdit() { |
GetRadWindow().Close(); |
} |
</script> |
Code executed on clicking a cancel button:
protected void LnkCancelChanges_Click(object sender, EventArgs e) |
{ |
ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "CancelEdit();", true); |
} |
Code executed on clicking "accept" button:
protected void LnkAcceptChanges_Click(object sender, EventArgs e) |
{ |
int result = SqlDataSourceEdit.Update(); |
ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "CloseAndRebind();", true); |
} |
JavaScript refresh grid function on content page:
function refreshGrid(arg) { |
$find("<%= RadAjaxManager.GetCurrent(this).ClientID %>").ajaxRequest("Rebind"); |
} |
Ajax request code on content page:
protected void RadAjaxManagerProxy1_AjaxRequest(object sender, AjaxRequestEventArgs e) |
{ |
RadGrid grid = (RadGrid)LoginView1.FindControl("RadMultiPageMain").FindControl("PageViewTarefas").FindControl("RadGridTarefas"); |
if (e.Argument == "Rebind") |
{ |
grid.MasterTableView.SortExpressions.Clear(); |
grid.MasterTableView.GroupByExpressions.Clear(); |
grid.Rebind(); |
} |
else if (e.Argument == "RebindAndNavigate") |
{ |
grid.MasterTableView.SortExpressions.Clear(); |
grid.MasterTableView.GroupByExpressions.Clear(); |
grid.MasterTableView.CurrentPageIndex = grid.MasterTableView.PageCount - 1; |
grid.Rebind(); |
} |
} |
Any Ideias?
Thanks in advance.