I have a radgrid. It has edit enabled only for first row.
When the edit is clicked it opens a new radwindow to collect additional information.
Also the radgrid allows row drag and drop.
On rowdrop it checks if the new position is going to be first row it opens the new window to collect similar data for the new first row.
Now when the row is edited and then if the row is dragged and droped two windows open.
If we drag one more time three windows open.
Tried a few things like
_menuwindow.DestroyOnClose = true;
WinManager.Windows.Clear();
But doesn't help.
Please help. How can I avoid opening unneccessary windows?
If I debug the code it doesn't really go to server to open the serverside window again.
I identify the two windows by giving different names server side and client side.
Any help is appreciated.
Thanks in advance.
Here is the code :
protected void UIProceduresGrid_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
{
GridDataItem gdItem = e.Item as GridDataItem;
if (gdItem != null)
{
if (e.CommandName == "PDFEdit")
{
WinManager.Windows.Clear();
RadWindow _menuwindow = new RadWindow();
_menuwindow.NavigateUrl = "ProcedureDependantFactors.aspx";
_menuwindow.VisibleOnPageLoad = true;
_menuwindow.ShowContentDuringLoad = true;
_menuwindow.Style.Value = "z-index:7010;";
_menuwindow.ID = "ProcedureDependantFactors";
_menuwindow.Modal = true;
_menuwindow.Height = 400;
_menuwindow.Width = 900;
_menuwindow.Title = "Procedure Dependant Factors Serverside";
_menuwindow.DestroyOnClose = true;
// _menuwindow.OnClientClose = "RefreshParentPage();";
WinManager.Windows.Add(_menuwindow);
}
}
}
function OnProcRowDropping(src, args) {
//alert("Dragged grid row index is: " + args._dragedItems[0]._itemIndexHierarchical + " Dropped target element index is: " + args._targetItemIndexHierarchical + " Position : " + args._dropPosition);
if (args._targetItemIndexHierarchical == 0 && args._dropPosition == 'above') {
if (!confirm('There is another record marked as primary that record will no longer be primary. And the dependant records will be deleted. Are you sure you want to proceed?')) {
args.set_cancel(true);
}
else {
ShowPDF();
}
}
}
function ShowPDF() {
var oManager = window.radopen("ProcedureDependantFactors.aspx");
oManager.DestroyOnClose = true;
oManager.Title = "Procedure Dependant Factors Clientside";
oManager.set_animation(Telerik.Web.UI.WindowAnimation.Fade);
oManager.set_behaviors(Telerik.Web.UI.WindowBehaviors.Close);
oManager.set_visibleStatusbar(false);
oManager.set_visibleTitlebar(true);
oManager.set_modal(true);
oManager.set_height("500px");
oManager.set_width("900px");
oManager.center();
oManager.SetActive();
oManager.show();
}
When the edit is clicked it opens a new radwindow to collect additional information.
Also the radgrid allows row drag and drop.
On rowdrop it checks if the new position is going to be first row it opens the new window to collect similar data for the new first row.
Now when the row is edited and then if the row is dragged and droped two windows open.
If we drag one more time three windows open.
Tried a few things like
_menuwindow.DestroyOnClose = true;
WinManager.Windows.Clear();
But doesn't help.
Please help. How can I avoid opening unneccessary windows?
If I debug the code it doesn't really go to server to open the serverside window again.
I identify the two windows by giving different names server side and client side.
Any help is appreciated.
Thanks in advance.
Here is the code :
protected void UIProceduresGrid_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
{
GridDataItem gdItem = e.Item as GridDataItem;
if (gdItem != null)
{
if (e.CommandName == "PDFEdit")
{
WinManager.Windows.Clear();
RadWindow _menuwindow = new RadWindow();
_menuwindow.NavigateUrl = "ProcedureDependantFactors.aspx";
_menuwindow.VisibleOnPageLoad = true;
_menuwindow.ShowContentDuringLoad = true;
_menuwindow.Style.Value = "z-index:7010;";
_menuwindow.ID = "ProcedureDependantFactors";
_menuwindow.Modal = true;
_menuwindow.Height = 400;
_menuwindow.Width = 900;
_menuwindow.Title = "Procedure Dependant Factors Serverside";
_menuwindow.DestroyOnClose = true;
// _menuwindow.OnClientClose = "RefreshParentPage();";
WinManager.Windows.Add(_menuwindow);
}
}
}
function OnProcRowDropping(src, args) {
//alert("Dragged grid row index is: " + args._dragedItems[0]._itemIndexHierarchical + " Dropped target element index is: " + args._targetItemIndexHierarchical + " Position : " + args._dropPosition);
if (args._targetItemIndexHierarchical == 0 && args._dropPosition == 'above') {
if (!confirm('There is another record marked as primary that record will no longer be primary. And the dependant records will be deleted. Are you sure you want to proceed?')) {
args.set_cancel(true);
}
else {
ShowPDF();
}
}
}
function ShowPDF() {
var oManager = window.radopen("ProcedureDependantFactors.aspx");
oManager.DestroyOnClose = true;
oManager.Title = "Procedure Dependant Factors Clientside";
oManager.set_animation(Telerik.Web.UI.WindowAnimation.Fade);
oManager.set_behaviors(Telerik.Web.UI.WindowBehaviors.Close);
oManager.set_visibleStatusbar(false);
oManager.set_visibleTitlebar(true);
oManager.set_modal(true);
oManager.set_height("500px");
oManager.set_width("900px");
oManager.center();
oManager.SetActive();
oManager.show();
}