This is a migrated thread and some comments may be shown as answers.

Launch Modal window from radGrid

9 Answers 304 Views
Grid
This is a migrated thread and some comments may be shown as answers.
rik butcher
Top achievements
Rank 1
rik butcher asked on 16 Sep 2011, 06:24 PM
Guys, this is a really really weird one for me.
we launch a modal window from a rowClick in radGrid:

 

 

string strfunction = String.Format("OpenWorkOrderDetails({0},{1},{2},{3})",

 

wonumber, wotypeid, locationid, woid);


the code above basically does the "window.open(wonumber, wotypeid, locationid, woid); from javascript and runs the Page Load event of the Page it's Opening.
usually passing the variable 'woid'
HOWEVER. For the Life of the Session, it never ever runs thru that Page load event again - only the first time.
And, you can select other rows go to another tab in the program & when you come back when you click that same row, the screen comes up exactly as it did the first time - completely skipping the "Page Load" event. if any changes were made on that window, it doesn't show them. it only shows the original data.
we're not caching anything, so, i dont understand how this is possible.
here's the  top part of that page - run inside of a master page.
is there anything that you can see & have you ever heard of anything like this before?
thanks again for any help.
rik

<%

 

@ Page Language="C#" MasterPageFile="~/NOVDarkBlue.Master" AutoEventWireup="true"

 

 

 

CodeBehind="InventoryConsole.aspx.cs" Inherits="NOV.GOLD.WebApp.Inventory.InventoryConsole" Culture="auto:en-US" UICulture="auto" %>

 

<

 

 

asp:Content ID="Content1" ContentPlaceHolderID="MainContentPlaceHolder" runat="server">

 

 

 

<script type="text/javascript" src="../Scripts/CommonFunctions.js"></script>

 

 

 

<script type="text/javascript" src="../Scripts/WorkOrders.js"></script>

 

 

 

<script type="text/javascript" src="../Scripts/Inventory.js"></script>

 

 

 

<telerik:RadWindowManager ID="RadWindowMnager1" runat="server" KeepInScreenBounds="true"

 

 

 

CssClass="RadWinManager" VisibleStatusbar="false">

 

 

 

<Windows>

 

 

 

<telerik:RadWindow ID="RadWindow1" runat="server" Modal="true" Width="600" Height="500"

 

 

 

ShowContentDuringLoad="false" Skin="WebBlue" Behaviors="Close,Move" />

 

 

 

</Windows>

 

 

 

</telerik:RadWindowManager>

 

 

 

<telerik:RadAjaxPanel ID="MainContentAjaxPanel" runat="server" LoadingPanelID="MasterAjaxLoadingPanel">

9 Answers, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 19 Sep 2011, 04:19 PM
Hi Rik,

Have you tried setting the DestroyOnClose and DestroyOnClose properties of the RadWindow to true in order to force it to reload its content on each show? What is the result of using them?
Properties that Affect Window Behavior

Greetings,
Tsvetina
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal
0
rik butcher
Top achievements
Rank 1
answered on 19 Sep 2011, 08:03 PM
none of those had any effect at all, either in radWindowManager or radWindow 

 

 

DestroyOnClose="true" ReloadOnShow="true"

 

 together or separate.
but, you are correct. the radGrid is definately caching for the life of the session.
0
rik butcher
Top achievements
Rank 1
answered on 19 Sep 2011, 08:42 PM

do you need to see the code of the window being opened? i'm not really sure how the radGrid is doing a cache. does it by default use the RadWindowManager? do u need the javascript doing the window.open()? it's passing a few properties.
thanks for any help.
this one's very strange to me.
rik

 

function

 

 

OpenModalWindow(url)

 

{

 

 

var winX = screen.width - 200;

 

 

 

var winY = screen.height - 200;

 

OpenModalWindowOfSize(url, winX, winY);

}

 

 

 

function

 

 

OpenModalWindowOfSize(url, width, height)

 

{

 

 

// Check for maximum width and height of modal window

 

 

 

 

 

 

 

 

if (width > maxModalWidth) { width = maxModalWidth; }

 

 

 

if (height > maxModalHeight) { height = maxModalHeight; }

 

 

 

var winLeft = (screen.width - width) / 2;

 

 

 

var winTop = (screen.height - height) / 2;

 

 

 

var winfeatures = 'width=' + width + ',height=' + height + ',menubar=no,titlebar=no,location=no,status=no,' +

 

 

 

'resizable=yes,scrollbars=yes,screenX=' + winLeft + ',screenY=' + winTop + ',modal=yes';

 

 

 

var modalfeatures = 'dialogWidth:' + width + 'px;dialogHeight:' + height + 'px;status:no;resizable:yes;' +

 

 

 

'dialogLeft:' + winLeft + ';dialogTop:' + winTop;

 

 

 

if (window.showModalDialog)

 

{

window.showModalDialog(url, window, modalfeatures);

}

 

 

else

 

 

 

 

 

 

{

window.open(url,

 

'modalwindow', winfeatures);

 

}

}

0
Tsvetina
Telerik team
answered on 20 Sep 2011, 01:48 PM
Hi Rik,

It seems that I have misunderstood you. You are actually not opening a RadWindow but a regular one using the window.open() method. I would suggest you to test your script with a simple asp:GridView instead of RadGrid to confirm whether the problem persists. This way you will know where to look at - the grid or your window opening logic.

All the best,
Tsvetina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
rik butcher
Top achievements
Rank 1
answered on 20 Sep 2011, 01:54 PM
thanks, i had already done that and it works just fine with GridView. so, i'm asking how is the radGrid doing a 'cache' and how do i stop it?
thx
rik
0
Tsvetina
Telerik team
answered on 20 Sep 2011, 02:11 PM
Hello Rik,

By default RadGrid has no caching, so there may be something else to this scenario. Could you please share your grid declaration as well, so that we can get a full idea of where the window is opened from?

Greetings,
Tsvetina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
rik butcher
Top achievements
Rank 1
answered on 20 Sep 2011, 02:23 PM
thanks. here's the declaration  - we're using multipage view so there's several grids. just sending one of the ones involved:
i put the databind method below this - the OpenReleaseDetails calls the javascript. pls let me know if i need to include anything else and thank u so much for your help on this.

 

 

<telerik:RadGrid runat="server" ID="OpenReleaseRadGrid" Skin="WebBlue" AllowPaging="true"

 

 

 

Width="1900px" AllowCustomPaging="true" PageSize="15" AutoGenerateColumns="false"

 

 

 

EnableTheming="false" OnNeedDataSource="OpenReleaseRadGrid_NeedDataSource" OnDeleteCommand="OpenReleaseRadGrid_DeleteCommand"

 

 

 

OnItemDataBound="OpenReleaseRadGrid_ItemDataBound">

 

 

 

<GroupingSettings CaseSensitive="false" />

 

 

 

<ClientSettings EnableRowHoverStyle="true" />

 

 

 

<PagerStyle Mode="NextPrevAndNumeric" />

 

 

 

<MasterTableView DataKeyNames="RELEASEID,LOCATIONID,LOCATIONNAME,CREATEDDATE,CREATEDBY,LASTUPDATED,LASTUPDATEDBY,RELEASECOLOR,WORKORDERITEMDISPLAY"

 

 

 

CommandItemSettings-ShowAddNewRecordButton="false" EditMode="PopUp" CommandItemDisplay="Top"

 

 

 

AllowSorting="true" CommandItemSettings-RefreshText="Refresh" CommandItemSettings-RefreshImageUrl="~/App_Themes/GOLD Main/ToolBar/refresh_16x16.gif">

 

 

 

<NoRecordsTemplate>

 

 

 

<div style="text-align: center; margin: 20px;">

 

There are no release items to display.

 

 

</div>

 

 

 

</NoRecordsTemplate>

 

 

 

<Columns>

 

 

 

<telerik:GridTemplateColumn AllowFiltering="false" HeaderStyle-Width="90px" UniqueName="OptionsMenuCell"

 

 

 

ItemStyle-HorizontalAlign="Left">

 

 

 

<ItemTemplate>

 

 

 

<asp:Image ID="RecordInfoImage" runat="server" ImageUrl="~/App_Themes/GOLD Main/Images/grid_info.gif"

 

 

 

CssClass="gridviewOptionsImage" />

 

 

 

<telerik:RadToolTip ID="InfoRadToolTip" runat="server" TargetControlID="RecordInfoImage"

 

 

 

Skin="Sunset" Position="MiddleRight" CssClass="gridviewToolTip" />

 

 

 

<asp:Image ID="PopupMenuImage" runat="server" ImageUrl="~/App_Themes/GOLD Main/Images/grid_menu_popup.gif"

 

 

 

CssClass="gridviewOptionsImage" />

 

 

 

<telerik:RadContextMenu ID="OptionsRadContextMenu" runat="server" Skin="WebBlue"

 

 

 

CssClass="leftText">

 

 

 

<Targets>

 

 

 

<telerik:ContextMenuControlTarget ControlID="PopupMenuImage" />

 

 

 

</Targets>

 

 

 

<Items>

 

 

 

<telerik:RadMenuItem Text="Report, Consolidated Shipping" ImageUrl="../App_Themes/GOLD Main/ToolBar/print_16x16.gif" />

 

 

 

<telerik:RadMenuItem Text="Report, Inventory In Yard" ImageUrl="../App_Themes/GOLD Main/ToolBar/print_16x16.gif" />

 

 

 

</Items>

 

 

 

</telerik:RadContextMenu>

 

 

 

<asp:ImageButton ID="DeleteItem" runat="server" ImageUrl="~/App_Themes/GOLD Main/ToolBar/trash_16x16.gif"

 

 

 

CommandName="Delete" CssClass="gridviewOptionsImage" OnClientClick="javascript:if(!confirm('This action will delete the selected work order. Are you sure?')){return false;}" />

 

 

 

</ItemTemplate>

 

 

 

</telerik:GridTemplateColumn>

 

 

 

<telerik:GridBoundColumn DataField="RELEASENUMBER" HeaderText="Release#" ReadOnly="true" />

 

 

 

<telerik:GridBoundColumn DataField="RELEASEDBY" HeaderText="Released By" />

 

 

 

<telerik:GridBoundColumn DataField="WORKORDERITEMDISPLAY" HeaderText="WO Item #" />

 

 

 

<telerik:GridBoundColumn DataField="TRUCKCARRIER" HeaderText="Carrier" />

 

 

 

<telerik:GridBoundColumn DataField="RELBYCOMPANYNAME" HeaderText="Customer" />

 

 

 

<telerik:GridBoundColumn DataField="MESSAGE" HeaderText="Status" />

 

 

 

<telerik:GridBoundColumn DataField="RELEASE1" HeaderText="Release #1" />

 

 

 

<telerik:GridBoundColumn DataField="DESTLOCATION" HeaderText="Destination" />

 

 

 

<telerik:GridBoundColumn DataField="DESTCITY" HeaderText="City" />

 

 

 

<telerik:GridBoundColumn DataField="DESTSTATE" HeaderText="State" />

 

 

 

<telerik:GridDateTimeColumn DataField="SHIPDATE" HeaderText="Shipping Date" DataFormatString="{0:dd-MMM-yyyy}" />

 

 

 

<telerik:GridDateTimeColumn DataField="RELEASEDATE" HeaderText="Release Date" DataFormatString="{0:dd-MMM-yyyy}" />

 

 

 

</Columns>

 

 

 

</MasterTableView>

 

 

 

</telerik:RadGrid>


............and the Item Databound Method:

 

protected

 

 

void OpenReleaseRadGrid_ItemDataBound(object sender, GridItemEventArgs e)

 

{

 

 

if (e.Item is GridDataItem)

 

{

 

 

GridDataItem boundItem = (GridDataItem)e.Item;

 

 

 

string releaseid = Convert.ToString(boundItem.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["RELEASEID"]);

 

 

 

string locationid = Convert.ToString(boundItem.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["LOCATIONID"]);

 

 

 

string location = Convert.ToString(boundItem.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["LOCATIONNAME"]);

 

 

 

string createdate = Convert.ToString(boundItem.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["CREATEDDATE"]);

 

 

 

string createdby = Convert.ToString(boundItem.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["CREATEDBY"]);

 

 

 

string lastupdate = Convert.ToString(boundItem.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["LASTUPDATED"]);

 

 

 

string lastupdateby = Convert.ToString(boundItem.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["LASTUPDATEDBY"]);

 

 

 

string workorderitemdisplay = Convert.ToString(boundItem.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["WORKORDERITEMDISPLAY"]);

 

 

 

string releasecolor = Convert.ToString(boundItem.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["RELEASECOLOR"]);

 

 

 

if (releasecolor.Trim() == "2")

 

{

 

 

foreach (TableCell cell in boundItem.Cells)

 

{

cell.BackColor = System.Drawing.

 

Color.Magenta;

 

}

}

 

 

else

 

 

 

 

 

{

 

 

if (workorderitemdisplay == "-")

 

{

 

 

foreach (TableCell cell in boundItem.Cells)

 

{

cell.BackColor = System.Drawing.

 

Color.Yellow;

 

}

}

}

 

 

string strfunction = String.Format("OpenReleaseDetails({0})",releaseid);

 

 

 

// Add the OnClick attributes to all the cells except the first one because it

 

 

 

 

 

 

 

// contains the popup menu for the row

 

 

 

 

 

 

 

foreach (TableCell cell in boundItem.Cells)

 

{

cell.Attributes.Add(

 

"OnClick", strfunction);

 

}

boundItem[

 

"OptionsMenuCell"].Attributes.Remove("OnClick");

 

 

 

// Format the tooltip for the record information

 

 

 

 

 

 

 

RadToolTip InfoToolTip = (RadToolTip)e.Item.Cells[0].FindControl("InfoRadToolTip");

 

InfoToolTip.Text =

 

"<b><u>Division</u></b><br/>" + location + "<br/><br/>" +

 

 

 

"<b><u>Release ID</u></b><br/>" + releaseid + "<br/><br/>" +

 

 

 

"<b><u>Created</u></b><br/>" + createdby + "&nbsp;&nbsp;" + createdate + "<br/><br/>" +

 

 

 

"<b><u>Last Updated</u></b><br/>" + lastupdateby + "&nbsp;&nbsp;" + lastupdate + "<br/>";

 

 

 

// Format the URLs for the popup menu items

 

 

 

 

 

 

 

RadMenu RadPopupMenu = (RadMenu)e.Item.Cells[0].FindControl("OptionsRadContextMenu");

 

RadPopupMenu.Items[0].NavigateUrl =

 

String.Format("javascript:OpenConsolidShipReport({0})", releaseid);

 

RadPopupMenu.Items[1].NavigateUrl =

 

String.Format("javascript:OpenInvInYardReport({0})",releaseid);

 

 

 

ImageButton deleteButton = (ImageButton)e.Item.Cells[0].FindControl("DeleteItem");

 

 

 

//identify if null or empty

 

 

 

 

 

deleteButton.Visible = (workorderitemdisplay ==

 

"-");

 

 

 

// Hide delete button if in view only mode

 

 

 

 

 

 

 

if (IsViewOnly || AllDivisions)

 

{

deleteButton.Visible =

 

false;

 

}

}

}

0
Tsvetina
Telerik team
answered on 20 Sep 2011, 03:46 PM
Hi Rik,

I tried a simple scenario using the main parts from your approach but could not replicate the issue, the Page_Load of the aspx loaded in the window runs each time. Take a look at the project and let me know what am I missing out.

Best wishes,
Tsvetina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
rik butcher
Top achievements
Rank 1
answered on 20 Sep 2011, 06:00 PM
i found the issue. it was in the javascript itself. it starts out calling window.open but i dug deeper and it uses a method : window.showModalDialog which caches to the browser and stays.
just appending  the url called with:
 URL += "&rt=" + GetCurrentDateTime();
keeps this from happening.
that was the issue all along & not a telerik problem. thank you so much for being patient w/ me.
thanks again
rik
Tags
Grid
Asked by
rik butcher
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
rik butcher
Top achievements
Rank 1
Share this question
or