6 Answers, 1 is accepted
0

Shinu
Top achievements
Rank 2
answered on 02 Mar 2011, 05:24 AM
Hello Albert,
You can attach OnClientClose event to the window and make an ajaxRequest like given below and from there you can call the desired function.
ClentSide:
C#:
Thanks,
Shinu.
You can attach OnClientClose event to the window and make an ajaxRequest like given below and from there you can call the desired function.
ClentSide:
function
OnClientClose ()
{
var
ajaxManager = $find(
"<%= RadAjaxManager1.ClientID %>"
);
ajaxManager.ajaxRequest();
}
C#:
protected
void
RadAjaxManager1_AjaxRequest(
object
sender, AjaxRequestEventArgs e)
{
//your code here
}
Thanks,
Shinu.
0

Spiros
Top achievements
Rank 1
answered on 19 May 2014, 07:32 AM
Hi All .
I have a similar problem. I am actually new to Telerik controls.
I have a server side RadWindow which is called from server
side. When the client respond how i can get the response from the client . Can you please provide me with a simple application ?
I have a similar problem. I am actually new to Telerik controls.
I have a server side RadWindow which is called from server
side. When the client respond how i can get the response from the client . Can you please provide me with a simple application ?
0

Shinu
Top achievements
Rank 2
answered on 19 May 2014, 08:08 AM
Hi Spiros,
Please have a look into the sample code snippet to achieve your scenario.
C#:
JavaScript:
Thanks,
Shinu.
Please have a look into the sample code snippet to achieve your scenario.
C#:
RadWindowManager1.RadConfirm(
"Are you sure you want to exit?"
,
"CallBackFunction"
, 500, 300,
null
,
"Confirm"
);
JavaScript:
function
CallBackFunction(args) {
//args will return the response
}
Thanks,
Shinu.
0

Spiros
Top achievements
Rank 1
answered on 19 May 2014, 08:40 AM
Thanks for your quick response. My problem is far more complex basically.
From JS
<telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
<script type="text/javascript" language="javascript">
function openWin() {
var oWnd = radopen("RadProducts.aspx", "RadWindow1");
}
function clientShow(sender, eventArgs) {
var txtInput = document.getElementById("txtInput");
sender.argument = txtInput.value;
}
function clientClose(sender, args) {
if (args.get_argument() != null) {
var txtInput = document.getElementById("txtInput");
txtInput.value = args.get_argument();
}
}
function OnClientClose(sender, args) {
var ajaxManager = $find("<%= RadAjaxManager1.ClientID %>");
alert(args);
ajaxManager.ajaxRequest(args);
}
</script>
</telerik:RadScriptBlock>
I can pass a textbox as a parameter but on the other form (Popup) i can not get from the
server the value sended
<script type="text/javascript" language="javascript">
function GetRadWindow() {
var oWindow = null;
if (window.radWindow)
oWindow = window.radWindow;
else if (window.frameElement.radWindow)
oWindow = window.frameElement.radWindow;
return oWindow;
}
function pageLoad() {
txtInput = document.getElementById('txtUserInput');
txtSecond = document.getElementById('TextBox1');
var currentWindow = GetRadWindow();
txtInput.value = currentWindow.argument;
}
function returnArg() {
var oWnd = GetRadWindow();
oWnd.close(txtSecond.value);
}
function cancelAndClose() {
var oWindow = GetRadWindow();
oWindow.close(null);
}
</script>
</telerik:RadScriptBlock>
Any idea .
Thanks
Spyros
From JS
<telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
<script type="text/javascript" language="javascript">
function openWin() {
var oWnd = radopen("RadProducts.aspx", "RadWindow1");
}
function clientShow(sender, eventArgs) {
var txtInput = document.getElementById("txtInput");
sender.argument = txtInput.value;
}
function clientClose(sender, args) {
if (args.get_argument() != null) {
var txtInput = document.getElementById("txtInput");
txtInput.value = args.get_argument();
}
}
function OnClientClose(sender, args) {
var ajaxManager = $find("<%= RadAjaxManager1.ClientID %>");
alert(args);
ajaxManager.ajaxRequest(args);
}
</script>
</telerik:RadScriptBlock>
I can pass a textbox as a parameter but on the other form (Popup) i can not get from the
server the value sended
<script type="text/javascript" language="javascript">
function GetRadWindow() {
var oWindow = null;
if (window.radWindow)
oWindow = window.radWindow;
else if (window.frameElement.radWindow)
oWindow = window.frameElement.radWindow;
return oWindow;
}
function pageLoad() {
txtInput = document.getElementById('txtUserInput');
txtSecond = document.getElementById('TextBox1');
var currentWindow = GetRadWindow();
txtInput.value = currentWindow.argument;
}
function returnArg() {
var oWnd = GetRadWindow();
oWnd.close(txtSecond.value);
}
function cancelAndClose() {
var oWindow = GetRadWindow();
oWindow.close(null);
}
</script>
</telerik:RadScriptBlock>
Any idea .
Thanks
Spyros
0

Shinu
Top achievements
Rank 2
answered on 20 May 2014, 08:02 AM
Hi Spiros,
Please have a look into the sample code snippet to pass value from parent page to Radwindow and from RadWindow to parent page.
Parent Page ASPX:
Parent Page JavaScript:
RadWindow Page ASPX:
RadWindow Page C#:
RadWindow Page JavaScript:
Hope this will helps you.
Thanks,
Shinu.
Please have a look into the sample code snippet to pass value from parent page to Radwindow and from RadWindow to parent page.
Parent Page ASPX:
<
telerik:RadTextBox
ID
=
"radtxtInput"
runat
=
"server"
Label
=
"Input"
>
</
telerik:RadTextBox
>
<
br
/>
<
telerik:RadTextBox
ID
=
"radtxtOutput"
runat
=
"server"
Label
=
"Output"
>
</
telerik:RadTextBox
>
<
br
/>
<
telerik:RadButton
ID
=
"radbtnOpenWin"
runat
=
"server"
AutoPostBack
=
"false"
OnClientClicked
=
"ShowDialoag"
Text
=
"Show Dialog"
>
</
telerik:RadButton
>
<
telerik:RadWindowManager
ID
=
"RadWindowManager1"
runat
=
"server"
OnClientClose
=
"OnClientClose"
>
</
telerik:RadWindowManager
>
Parent Page JavaScript:
<script type=
"text/javascript"
>
function
ShowDialoag(sender, args) {
var
textbox = $find(
"<%=radtxtInput.ClientID%>"
);
radopen(
"ShowDialog.aspx?TextBoxValue="
+ textbox.get_value(),
null
);
}
function
OnClientClose(oWnd, args) {
var
arg = args.get_argument();
if
(arg) {
var
txtValue = arg.txtValue;
$find(
"<%=radtxtOutput.ClientID%>"
).set_value(txtValue);
}
}
</script>
RadWindow Page ASPX:
<
telerik:RadTextBox
ID
=
"radtxtAccept"
runat
=
"server"
>
</
telerik:RadTextBox
>
<
telerik:RadButton
ID
=
"radbtnClosewin"
runat
=
"server"
Text
=
"Close with argument"
AutoPostBack
=
"false"
OnClientClicked
=
"returnToParent"
>
</
telerik:RadButton
>
RadWindow Page C#:
protected
void
Page_Load(
object
sender, EventArgs e)
{
radtxtAccept.Text = Request.QueryString[
"TextBoxValue"
];
}
RadWindow Page JavaScript:
function
returnToParent() {
var
oArg =
new
Object();
oArg.txtValue = $find(
"<%=radtxtAccept.ClientID %>"
).get_value();
var
oWnd = GetRadWindow();
if
(oArg.txtValue) {
oWnd.close(oArg);
}
}
function
GetRadWindow() {
var
oWindow =
null
;
if
(window.radWindow) oWindow = window.radWindow;
else
if
(window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
return
oWindow;
}
Hope this will helps you.
Thanks,
Shinu.
0

Spiros
Top achievements
Rank 1
answered on 20 May 2014, 01:26 PM
Thanks very much for your quick response.
I just run the code and works fine .
Thanks
Spyros
I just run the code and works fine .
Thanks
Spyros