Hello,
In my current project I am using the RadWindow object quite a bit and I am running into a lot of trouble with it.
One page in my project calls the RadWindow object twice. The RadWindow populate data in a radgrid and on the select command of the grid the RadWindow should close. The RadWindow is called from server side code.
The issue I have noticed is that when I first load the page and make the RadWindow call, the RadWindow page_load event gets called once, the next time I call the RadWindow object from another location on the same page, the page_load of the RadWindow triggers twice. The page_load triggers as many times as I call the RadWindow object from the page.
Combine the above with the radgrid select. If the radwindow page_load happens twice then the radgrid select happens twice. The normal behavior of select in my code is to pass the selected item to the parent page and close the RadWindow and return to the parent control. However the select of the radgrid triggers as many times as the page_load event triggers.
Could you please let me know how to handle this scenario.
Thanks!!
Below are snippets of my code.
Parent page from where the RadWindow is loaded.
Javascript on the parent page to handle the OnClientClose event.
Code to invoke the RadWindow server side
Code in the select index changed event for the radgrid in the radwindow
Javascript code to handle the returntoParent function of the radwindow
In my current project I am using the RadWindow object quite a bit and I am running into a lot of trouble with it.
One page in my project calls the RadWindow object twice. The RadWindow populate data in a radgrid and on the select command of the grid the RadWindow should close. The RadWindow is called from server side code.
The issue I have noticed is that when I first load the page and make the RadWindow call, the RadWindow page_load event gets called once, the next time I call the RadWindow object from another location on the same page, the page_load of the RadWindow triggers twice. The page_load triggers as many times as I call the RadWindow object from the page.
Combine the above with the radgrid select. If the radwindow page_load happens twice then the radgrid select happens twice. The normal behavior of select in my code is to pass the selected item to the parent page and close the RadWindow and return to the parent control. However the select of the radgrid triggers as many times as the page_load event triggers.
Could you please let me know how to handle this scenario.
Thanks!!
Below are snippets of my code.
Parent page from where the RadWindow is loaded.
<
telerik:RadWindowManager
runat
=
"server"
ID
=
"WindowMgr"
Skin
=
"abc"
EnableEmbeddedSkins
=
"false"
>
</
telerik:RadWindowManager
>
Javascript on the parent page to handle the OnClientClose event.
<
script
type
=
"text/javascript"
>
function SetTextBoxValue(oWnd, args) {
//check if a value is returned from the dialog
var arg = args.get_argument();
if (arg) {
//do something
}
}
</
script
>
Code to invoke the RadWindow server side
Dim popUp As Telerik.Web.UI.RadWindow = New Telerik.Web.UI.RadWindow()
popUp.ID = "selectOrg"
popUp.OnClientClose = "SetTextBoxValue"
popUp.NavigateUrl = "someurl"
popUp.VisibleOnPageLoad = True
popUp.EnableEmbeddedSkins = False
popUp.Skin = "abc"
popUp.VisibleStatusbar = False
popUp.VisibleTitlebar = False
popUp.Modal = True
popUp.Behaviors = Telerik.Web.UI.WindowBehaviors.None
popUp.ShowContentDuringLoad = True
popUp.Height = Unit.Pixel(450)
popUp.Width = Unit.Pixel(500)
WindowMgr.Windows.Add(popUp)
Code in the select index changed event for the radgrid in the radwindow
ClientScript.RegisterStartupScript(Page.GetType(), "ey", "returnToParent('" + strSomeValue + "');", True)
Javascript code to handle the returntoParent function of the radwindow
function returnToParent(refControl) {
//create the argument that will be returned to the parent page
var oArg = new Object();
//get the control to modify on Parent
oArg.ControlToModify = refControl
//get a reference to the current RadWindow
var oWnd = GetRadWindow();
//Close the RadWindow and send the argument to the parent page
if (oArg.ControlToModify) {
oWnd.close(oArg);
}
}