Eric Wright
Top achievements
Rank 1
Eric Wright
asked on 06 Jan 2010, 03:11 PM
Hi all,
I have created a RadWindow in my code-behind file for an asp page. I need to create it there on the fly. I am using it as a confirm box to validate an address. The problem I am having is I have no way to close the RadWindow to get back to my parent page if the user needs to go back to mess with the form.
Any suggestions?
I have created a RadWindow in my code-behind file for an asp page. I need to create it there on the fly. I am using it as a confirm box to validate an address. The problem I am having is I have no way to close the RadWindow to get back to my parent page if the user needs to go back to mess with the form.
Any suggestions?
6 Answers, 1 is accepted
0
Hello Eric,
In order to close the radWindow from the server you should execute the script which is used for its closure from the server side. You can find a detailed blogpost on how to do this below:
http://blogs.telerik.com/blogs/posts/09-05-05/executing_javascript_function_from_server-side_code.aspx
In case you need further assistance, please share some relevant code along with very detailed explanations of the problem and we will do our best to help.
Best wishes,
Svetlina
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
In order to close the radWindow from the server you should execute the script which is used for its closure from the server side. You can find a detailed blogpost on how to do this below:
http://blogs.telerik.com/blogs/posts/09-05-05/executing_javascript_function_from_server-side_code.aspx
In case you need further assistance, please share some relevant code along with very detailed explanations of the problem and we will do our best to help.
Best wishes,
Svetlina
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Eric Wright
Top achievements
Rank 1
answered on 06 Jan 2010, 03:34 PM
I have two aspx pages with each of them having their own code behind.
Default1.aspx.cs creates the RadWindow and displays it on a button click. (a search button from the Default.aspx form)
As you can see, the newwindow.NavigateUrl is pointing to another aspx page called Default2.aspx. This is where I pass a string into a label created there. It displays and asks the user if they like the result or not. Yes/No buttons. When the user clicks No, I want to close the RadWindow (Default2.aspx) and display the parent page (Default.aspx). So I can not write some script to be stored in a label in Default2.aspx because the code-behind for that file (Default2.aspx.cs) does not have the RadWindow object in it. I am playing with two different pages here.
I don't know if there is anyway to do what I am trying to achieve.
Default1.aspx.cs creates the RadWindow and displays it on a button click. (a search button from the Default.aspx form)
| private void createRad(){ |
| Telerik.Web.UI.RadWindow newwindow = new Telerik.Web.UI.RadWindow(); |
| newwindow.ID = "RadWindow2"; |
| newwindow.NavigateUrl = "Default2.aspx?value=" + final; |
| RadWindowManager1.Windows.Add(newwindow); |
| newwindow.Modal = true; |
| newwindow.VisibleStatusbar = false; |
| newwindow.VisibleTitlebar = false; |
| newwindow.ShowContentDuringLoad = false; |
| newwindow.Height = 200; |
| newwindow.Width = 500; |
| newwindow.VisibleOnPageLoad = true; |
| } |
As you can see, the newwindow.NavigateUrl is pointing to another aspx page called Default2.aspx. This is where I pass a string into a label created there. It displays and asks the user if they like the result or not. Yes/No buttons. When the user clicks No, I want to close the RadWindow (Default2.aspx) and display the parent page (Default.aspx). So I can not write some script to be stored in a label in Default2.aspx because the code-behind for that file (Default2.aspx.cs) does not have the RadWindow object in it. I am playing with two different pages here.
I don't know if there is anyway to do what I am trying to achieve.
0
Accepted
Hi Eric Wright,
As far as I understand you want to close the RadWindow from the page which is loaded inside it and not from the main page. If so, you can reference teh RadWindow object from inside teh content page by using the following function:
After you declare this function, you can reference the RadWindow client object and close it by using GetRadWindow().close() (on the client or on the server as already explained). You can find this function below:
http://www.telerik.com/help/aspnet-ajax/window_programmingopeningfromwithin.html
A sample online demo which uses it in a very similar manner as you need is the following one:
http://demos.telerik.com/aspnet-ajax/window/examples/dialogreturnvalue/defaultcs.aspx
I hope that my reply is helpful, let me know if you have further questions.
Sincerely yours,
Svetlina
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
As far as I understand you want to close the RadWindow from the page which is loaded inside it and not from the main page. If so, you can reference teh RadWindow object from inside teh content page by using the following function:
function GetRadWindow() { var oWindow = null; if (window.radWindow) oWindow = window.radWindow; else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow; return oWindow; }After you declare this function, you can reference the RadWindow client object and close it by using GetRadWindow().close() (on the client or on the server as already explained). You can find this function below:
http://www.telerik.com/help/aspnet-ajax/window_programmingopeningfromwithin.html
A sample online demo which uses it in a very similar manner as you need is the following one:
http://demos.telerik.com/aspnet-ajax/window/examples/dialogreturnvalue/defaultcs.aspx
I hope that my reply is helpful, let me know if you have further questions.
Sincerely yours,
Svetlina
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Eric Wright
Top achievements
Rank 1
answered on 06 Jan 2010, 04:07 PM
Svetlina,
Thank you very much...that is exactly what I needed to do to get that to work!
I saw that function before, but I guess I needed it spelled out for me to understand it.
Thanks again,
Eric
Thank you very much...that is exactly what I needed to do to get that to work!
I saw that function before, but I guess I needed it spelled out for me to understand it.
Thanks again,
Eric
0
Eric Wright
Top achievements
Rank 1
answered on 06 Jan 2010, 05:59 PM
Ok..I have one more question.
How can I let the first page know that the 'Yes' button was selected so I can run some more code on the parent page?
How can I let the first page know that the 'Yes' button was selected so I can run some more code on the parent page?
0
Eric Wright
Top achievements
Rank 1
answered on 07 Jan 2010, 12:00 AM
Never mind......I figured out a solution!