|
-
October 20th, 2008, 02:29 AM
#1
javascript confirm box - delete call in servder side
Hello
In my web page (asp net 2.0), shows some data from database based on a search click, I placed another button for delete. When user click on the
delete button - a client event is fired displaying confirm box, as shown below.
1. When user clicks yes, I want to call actual delete procedure (running in server side). How can I invoke the delete procedure in server side.
when user clicks yes, if ckicks no, no need to call server procedure.
2. Can we access/delete an entry from database using pure javascript code
running from client side.
Thnks in advance
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="Button1" runat="server" Text="Remove"
OnClientClick="javascript:return confirm('Are you sure you want to delete this entry?');" /></div>
</form>
</body>
</html>
VB.Net 2005, Net Framework 2.0
-
October 21st, 2008, 10:44 AM
#2
Re: javascript confirm box - delete call in servder side
button_click()
{
// write the code for delete from table...
important is that, only when user click yes this even will be fired
}
-
October 21st, 2008, 02:43 PM
#3
Re: javascript confirm box - delete call in servder side
If you are are working with a mix of client-side and server-side, then you have to pass the information from the client-side to the server.
Code:
<script type="text/javascript">
function deleteStuff() {
if (confirm('Are you sure you want to delete this entry?')) {
window.location = 'page.asp?delete=SOME_ID';
}
}
</script>
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|