Hi,
I want to do some coding on OnClientCloseHandler event of a RadWindow.
I added a RadWindowManager and dynamically added RadWindow and how can code against the OnClientCloseHandler event of RadWindow .
Please provide a solution.
Thanks for any assistance
I want to do some coding on OnClientCloseHandler event of a RadWindow.
I added a RadWindowManager and dynamically added RadWindow and how can code against the OnClientCloseHandler event of RadWindow .
Please provide a solution.
Thanks for any assistance
6 Answers, 1 is accepted
0

Princy
Top achievements
Rank 2
answered on 25 Jul 2012, 09:39 AM
Hi Pradeep,
You can attach the OnClientClose event as show below.
ASPX:
C#:
JS:
Hope this helps.
Regards,
Princy.
You can attach the OnClientClose event as show below.
ASPX:
<
telerik:RadWindowManager
ID
=
"RadWindowManager1"
runat
=
"server"
>
</
telerik:RadWindowManager
>
C#:
RadWindow RadWindow1 = new RadWindow();
RadWindow1.ID = "RadWindow1";
RadWindow1.VisibleOnPageLoad = true;
RadWindow1.OnClientClose = "OnClientClose";
RadWindowManager1.Windows.Add(RadWindow1);
JS:
<script type=
"text/javascript"
>
function
OnClientClose(sender, args) {
alert(
"RadWindow Closed"
);
//Your code
}
</script>
Hope this helps.
Regards,
Princy.
0

Abhi
Top achievements
Rank 1
answered on 06 Sep 2012, 09:53 AM
HI Princy,
I have done the same way in which you have mentioned in your post. I have implemented the __doPostBack in OnClientClose event. But when i checked the Request.Form["__EVENTTARGET"] in default.aspx (the url i passed in RadWindow1.NavigateUrl), it is always null. i have done the same in normal aspx page (not MDI), it is working fine. Can you help me to solve this issue.
In page load of MDI.aspx.cs
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
RadWindow RadWindow1 = new RadWindow();
RadWindow1.ID = "RadWindow1";
RadWindow1.VisibleOnPageLoad = false;
RadWindow1.OnClientClose = "OnClientCloseClick";
RadWindow1.NavigateUrl = String.Format("Default.aspx?ID=" + Request.QueryString["ID"]);
RadWindowManager1.Windows.Add(RadWindow1);
}
}
function OnClientCloseClick(sender, args) {
__doPostBack('SaveSettingOnClose', 'OnClose'); return false;
}
---------------------
In page load of default.aspx.cs
protected void Page_Load(object sender, EventArgs e)
{
if (Request.Form["__EVENTTARGET"] == "SaveSettingOnClose")
{
SaveSettingOnClose();
}
}
Here when i have checked the Request.Form["__EVENTTARGET"] , it is always null.
Thanks
Abhi
I have done the same way in which you have mentioned in your post. I have implemented the __doPostBack in OnClientClose event. But when i checked the Request.Form["__EVENTTARGET"] in default.aspx (the url i passed in RadWindow1.NavigateUrl), it is always null. i have done the same in normal aspx page (not MDI), it is working fine. Can you help me to solve this issue.
In page load of MDI.aspx.cs
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
RadWindow RadWindow1 = new RadWindow();
RadWindow1.ID = "RadWindow1";
RadWindow1.VisibleOnPageLoad = false;
RadWindow1.OnClientClose = "OnClientCloseClick";
RadWindow1.NavigateUrl = String.Format("Default.aspx?ID=" + Request.QueryString["ID"]);
RadWindowManager1.Windows.Add(RadWindow1);
}
}
function OnClientCloseClick(sender, args) {
__doPostBack('SaveSettingOnClose', 'OnClose'); return false;
}
---------------------
In page load of default.aspx.cs
protected void Page_Load(object sender, EventArgs e)
{
if (Request.Form["__EVENTTARGET"] == "SaveSettingOnClose")
{
SaveSettingOnClose();
}
}
Here when i have checked the Request.Form["__EVENTTARGET"] , it is always null.
Thanks
Abhi
0

Princy
Top achievements
Rank 2
answered on 06 Sep 2012, 01:11 PM
Hi Abhi,
Since OnClientCloseClick is in the Parent page (MDI.aspx) it will cause the parent page to postback. Since the ViisibleOnPageLoad property of RadWindow is set to false the Radwindow will not be shown after the postback. You can trigger postback in the child page as follows.
Parent page
JS:
Child page
JS:
Hope this helps.
Thanks,
Princy.
Since OnClientCloseClick is in the Parent page (MDI.aspx) it will cause the parent page to postback. Since the ViisibleOnPageLoad property of RadWindow is set to false the Radwindow will not be shown after the postback. You can trigger postback in the child page as follows.
Parent page
JS:
<script type=
"text/javascript"
>
function
OnClientCloseClick(sender, args)
{
var
oWnd = GetRadWindowManager().getWindowByName(
"RadWindow1"
);
oWnd.get_contentFrame().contentWindow.SaveSettingOnClose();
}
</script>
Child page
JS:
<script type=
"text/javascript"
>
function
SaveSettingOnClose()
{
__doPostBack(
'SaveSettingOnClose'
,
'OnClose'
);
}
</script>
Hope this helps.
Thanks,
Princy.
0

Abhi
Top achievements
Rank 1
answered on 06 Sep 2012, 02:11 PM
Hi Princy,
I have implemented the things in your way. Now the value of Request.Params.Get("__EVENTARGUMENT") is ', ' (coma). Please tell me why this happens.
Thanks
Abhi
I have implemented the things in your way. Now the value of Request.Params.Get("__EVENTARGUMENT") is ', ' (coma). Please tell me why this happens.
Thanks
Abhi
0

Abhi
Top achievements
Rank 1
answered on 07 Sep 2012, 04:51 AM
Hi Princy,
Now it is working as expected. Earlier i have added function
__doPostBack(eventTarget, eventArgument) {
document.Form1.__EVENTTARGET.value = eventTarget;
document.Form1.__EVENTARGUMENT.value = eventArgument;
document.Form1.submit();
}
and
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
In my code.When i removed those codes from my program, it is working fine as expected. Sorry for the earlier post.
Thanks
Abhi
Now it is working as expected. Earlier i have added function
__doPostBack(eventTarget, eventArgument) {
document.Form1.__EVENTTARGET.value = eventTarget;
document.Form1.__EVENTARGUMENT.value = eventArgument;
document.Form1.submit();
}
and
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
In my code.When i removed those codes from my program, it is working fine as expected. Sorry for the earlier post.
Thanks
Abhi
0

Abhi
Top achievements
Rank 1
answered on 13 Sep 2012, 10:18 AM
Hi Princy,
Again i faced an issue. When i am re ordering columns and saving settings, it is not getting saved. ReorderColumnsOnClient="True" in my rad grid. Any change that is happening in server side is getting saved and those happening in client side is not getting saved. Is there any possible way to save both client and server changes performing on the grid.
Thanks
Abhi
Again i faced an issue. When i am re ordering columns and saving settings, it is not getting saved. ReorderColumnsOnClient="True" in my rad grid. Any change that is happening in server side is getting saved and those happening in client side is not getting saved. Is there any possible way to save both client and server changes performing on the grid.
Thanks
Abhi