Prevent users from doing stupid things. Like setting their computer on fire. Fire… mmmmm.

Don't play with matches!Ok, not that you will provide your application with features like setting someone’s computer on fire, but lot’s of time you may need to provide those buttons titled „clear all“, „remove all“, „delete everything“. Making sure that’s what user really wants to do can save a lot of time and anger to your users. For ages, windows based applications had these „are you really sure…“ modal pop ups. However, to do that with asp.net was traditionally a bit of a problem. You would usually need to implement javascript and then make client side script communicate with the server side.

Luckily, this is really, really simple now. All you need to use is ConfirmButtonExtender that comes with Atlas Control Toolkit. So here is what you do. You make you application, just as you would do normally. You have a button that will do something when clicked. The only difference is now that you add a new control, namely, ConfirmButtonExtender. This control has two properties : TargetControlID (the ID of the button which does the operation that will be confirmed) and ConfirmText (the message that you want to ask your user, something like “are you really sure you want to do this”). Here is the code :

OPEN CODE IN NEW WINDOW

The whole project you can download here from reBlogger lab.


This blog is being delivered to you by
reBlogger.com
“Do you know what your employees are blogging about?”


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: