Click here to Skip to main content
14,608,021 members
Rate this:
Please Sign up or sign in to vote.
See more:
I have an aspx page.

In that page I am displaying div when click on link.
Div contains iframe and I am assigning an url to the frame like below.

<asp:LinkButton ID="lkbtn" Text="Create" OnClientClick="return ShowDiv(this)" runat="server">
// Function to Show the Div //
function ShowDiv(CtrlName)
document.getElementById('divUserCtrl').style.display = 'inline';
frames['ifrm'].window.location = "CreateProject.aspx?ProjCat=G";
return false;

When I click on linkbutton I am able to display div and redircting to CreateProject page but in CreateProject when I click on a button I need to close this div.

How can I do this in c#. I tried:

Page.RegisterStartupScript("Reload", "<script>window.close();</script>"); 

But no luck :(
Updated 2-Sep-10 1:04am
Dalek Dave 2-Sep-10 7:04am
Edited for Grammar and Code Blocks.

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

Use Self instead of window
<a href="javascript:self.close()">Close </a>

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100