![]() |
Prompt confirmation after button click
I wish to add an attribute to the button click in asp.net to prompt a confirmation box using javascript. Also, is it possible to perform a function after a button click before i prompt the confirmation box? This function will return a value indicating whether i should prompt the confirmation box.
I know i should add a code as shown below but it does not work somehow: Code:
btnDelete.Attributes.Add("onClick", "javascript:return confirm('Are you sure you want to delete these rows?')") |
Here is an article that walks you through exactly how to do that. Hope it helps.
|
I tried the coding but it does not work for my webform with other coding. But if i create a new webform, it will work. Not sure why though ...
|
I don't know how you're building your applications, but if you're using Visual Studio to do them, and the "are you sure" file is a code-behind file, Visual Studio builds the .dll file for it automatically. If you do an Add Existing Item within Visual Studio to an existing application, Visual Studio should still build the .dll file for you.
OTOH, if you're not using Visual Studio, you may have to build the .dll file yourself for the "are you sure" file and put it in your root directory. If none of the above applies, then I'm as puzzled as you are. |
Quote:
|
Sorry for late reply, didnt know that you have submitted a new post. Anyway, i know why it does not work, because in my asp.net i included a onclick function in javascript for the same button causing it not to work.
I now use that onclick function javascript to prompt for me the confirmation box. Thanks |
| All times are GMT +1. The time now is 12:42 AM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.