When clicking on a button (BtnDelete) on my mypage.aspx, I want to show a messagebox to confirme before deleting. I tried with the code below but nothing happens and the information is deleted from the database without any message box appearing. can you add the appropriate code to the code below so that it will work. Thanks.
Private Sub BtnDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnDelete.Click
'Shows a confirmation box when button delete is clicked
BtnDelete.Attributes.Add("onclick", "return confirm('are you sure you want to delete? ');")
'Declare objects and create a connection
Dim myConnection As OdbcConnection = New OdbcConnection(ConfigurationSettings.AppSettings("connectionString"))
Dim CmdString As String = "Delete From Kunder Where (ordernr = ? )"
Dim myCommand As New OdbcCommand
'Get parameter values from admin_kund.aspx
Dim strOrdernr As String
strOrdernr = Request.QueryString("ID")
myCommand.Connection = myConnection
myCommand.CommandText = CmdString
Catch ex As Exception
Way to late to set the attribute! If you set it in the event handler for the button itself it has already been clicked and the form has already been posted back. You should set the onlick
Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.
Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
In .NET 2.0, Microsoft introduced the Web Site. This was the default way to create a web Project in Visual Studio 2005. In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x
The Web Si…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
The Email Laundry PDF encryption service allows companies to send confidential encrypted emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…