force close the aspx page.

R

Robbe Morris [C# MVP]

client side javascript

window.close();

Once the page has been delivered to the browser. The server
cannot send a command to it until the client sends another request.

So, you have to do this client side in some fashion.
 
E

Eitan M

What I did,
on page_load event, I added the code :

Dim btn As Button

btn = CType(btnOK, Button)

btn.Attributes.Add("onclick", _

String.Format("window.close();"))



Dialog truely close, thanks.

(so there are event onclick on the client, and onclick on the server).

One problem is that just after closing the dialog,

the contents of the dialog appear in a new window (In IE web browser),

Which I don't want that this will happen.



What may be wrong ?



Thanks :)
 
E

Eitan M

What I did,
on page_load event, I added the code :

Dim btn As Button

btn = CType(btnOK, Button)

btn.Attributes.Add("onclick", _

String.Format("window.close();"))



Dialog truely close, thanks.

(so there are event onclick on the client, and onclick on the server).

One problem is that just after closing the dialog,

the contents of the dialog appear in a new window (In IE web browser),

Which I don't want that this will happen.



What may be wrong ?

Also I don't want that on_load event occurs just after pressing the
server-side button.

Thanks :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top