radhakrishan
asked on
Modal Window Close
Hi Experts,
could anyone tell me, how to close a modal window on click of a button.
Using window.close does'nt seems to work.
Cheers
could anyone tell me, how to close a modal window on click of a button.
Using window.close does'nt seems to work.
Cheers
How are you opening the window ? Where is you code to close the window ?
ASKER
Hi Carl,
The window is opened from another page and on click of a close button i wrote the following code:
(The click button is on the modal window page)
private void Button1_Click(object sender, System.EventArgs e)
{
string s1 = "<script>window.close();</ script>";
Response.Write(s1);
}
The window is opened from another page and on click of a close button i wrote the following code:
(The click button is on the modal window page)
private void Button1_Click(object sender, System.EventArgs e)
{
string s1 = "<script>window.close();</
Response.Write(s1);
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Carl,
Doing that, gives me a compiler error:
CS1026 ) Expected....
Doing that, gives me a compiler error:
CS1026 ) Expected....
Can you post the definition of your Button as you have it now ? And also the line that is causing the compile error ?
ASKER
<asp:Button id="Button1" style="Z-INDEX: 105; LEFT: 224px; POSITION: absolute; TOP: 216px" runat="server"
Width="96px" Text="Close" onclick="javascript:window .close();" ></asp:But ton>
And the highlighted line is the first line:
with same error CS1026 ) Expected.
Width="96px" Text="Close" onclick="javascript:window
And the highlighted line is the first line:
with same error CS1026 ) Expected.
ASKER
I think I got the solution:
this.Button1.Attributes.Ad d("onclick ", "window.close(); return false;");
This works fine for me.
Cheers
this.Button1.Attributes.Ad
This works fine for me.
Cheers