can I disable a user control in a web page

G

Guest

1. Can I disable a user control in a web page?
2. Can I disable the 'close' function on the top-right corner of a popup
window, so I can use code-behind function to close the browser?
 
S

Steven Nagy

1. Yes. All controls have an "enabled" property which can be set to
false.
2. No. Possibly javascript might let you, although I doubt it. You have
to remember that ASP.NET is server side code, which means it can do
stuff on the server like talk to databases. Javascript is client side
code. It can do stuff funky in the browser, muck around with windows,
etc.
 
G

Guest

Thank you, Steven.

For the second question, I found two methods in javascript:

1. window.open
2. window.showModalDialog

There is no way to disable 'close' function for those methods, do you have
other way to handle that?
 
L

Laurent Bugnion

Hi,
Thank you, Steven.

For the second question, I found two methods in javascript:

1. window.open
2. window.showModalDialog

There is no way to disable 'close' function for those methods, do you have
other way to handle that?

No way. The browser's interface is protected by strict security,
JavaScript has very little rights to interact with the default chromes.

HTH,
Laurent
 
S

Steven Nagy

Ron,

As Laurent suggests, you can't do it.
If you think about it, this is a good thing.
Otherwise every site would be doing it, and no one would ever be able
to close a browser window.

Steven
 
S

Steven Nagy

When you are talking about a user control, you DO mean an ASP.NET user
control right?
 

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,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top