API Questions on Kentico API.
Version 5.x > API > refresh page after cloosing a modal page View modes: 
User avatar
Member
Member
mj-y - 2/13/2013 7:21:22 AM
   
refresh page after cloosing a modal page
hi
I have created an aspx page contain a button that open a modal page ( a page that inherited from ModalDialogPage.master). how can I refresh the main page after closing modal page?
thanks in advance for your answers

User avatar
Kentico Consulting
Kentico Consulting
richards@kentico.com - 2/27/2013 1:24:47 AM
   
RE:refresh page after cloosing a modal page
Hello,

Would it be possible for you to give us more detailed information of how your page looks like? What modal page are you using? Could you described your goal more closely and maybe send screenshow of your modal page?

In general - you could listen to modal page actions and refresh the parent window with javascript.

Best regards,
Richard Sustek

User avatar
Member
Member
mj-y - 3/3/2013 7:33:48 AM
   
RE:refresh page after cloosing a modal page
Hi dear Richard
The button exactly is an action of a unigrid (in the picture below, after pressing reject the modal page apeared as shown). In modal page the user can change some data of the unigrid ... so the unigrid shoud be refreshed after closing modal page. I will appreciate if u write a sample code for me .

User image

User avatar
Kentico Consulting
Kentico Consulting
richards@kentico.com - 3/4/2013 11:04:27 AM
   
RE:refresh page after cloosing a modal page
Hi,

I'm sorry but it seems like this functionality is not supported in Kentico 5.5, could you please upgrade to a newer version of Kentico? It will bring you much more functionality and stability. The unigrid has also been improved.

If you would want to do this in your version of Kentico the solution would not be an easy one - you would need to bind an event to the button click (the close/reject button or whatever you want) and do an javascript window refresh action when the button is clicked. Sorry for any inconviniences.

Best regards,
Richard Sustek

User avatar
Member
Member
mj-y - 3/5/2013 12:45:45 AM
   
RE:refresh page after cloosing a modal page
Hi Richard
Thx for your reply ... I checked some other parts of CMS and found the code below.
in the mdoal.aspx page the below javascript code should be added :
 <script type="text/javascript">
// Closes modal dialog and refresh parent window
function CloseAndRefresh() {
window.close();
wopener.location.replace(wopener.location);
}
</script>
<asp:Literal ID="ltlScript" runat="server" />

and in the modal.aspx.cs under the button event the code below shoud be added:

ltlScript.Text = ScriptHelper.GetScript("CloseAndRefresh();");

User avatar
Kentico Consulting
Kentico Consulting
richards@kentico.com - 3/6/2013 2:34:52 AM
   
RE:refresh page after cloosing a modal page
Hi,

Thanks for sharing that! Does it work correctly or have you encountered any issues? Let us know if you need anything.

Best regards,
Richard Sustek