SUN Jiangong
SUN Jiangong

Reputation: 5312

How to close popup window in ASP

I want to close a popup window when i click a linkbutton in asp page.

<asp:LinkButton ID="lb" runat="server" Text="<%#Text %>" OnClick="javascript:window.close()" ></asp:LinkButton>

The error code is : "CS1026: ) expected"

I've searched for it on internet, but i can't find the solution. Does anyone knows how to solve it?

Thanks

Upvotes: 0

Views: 4350

Answers (2)

chrr
chrr

Reputation: 320

Try:

<asp:LinkButton ID="lb" runat="server" Text="<%#Text %>" OnClientClick="window.close();"></asp:LinkButton>

or

<asp:LinkButton ID="lb" runat="server" Text="<%#Text %>" OnClientClick="javascript: window.close();"></asp:LinkButton>

Upvotes: 0

Ghyath Serhal
Ghyath Serhal

Reputation: 7632

Try this

<asp:LinkButton ID="lb" runat="server" Text="<%#Text %>" OnClientClick="this.close();"></asp:LinkButton>

Upvotes: 1

Related Questions