This is what im trying.
'Declaring the variables.
Dim dbCmd As New SqlClient.SqlCommand
Dim dbConn As New SqlClient.SqlConnection
Dim dbAdap As New SqlClient.SqlDataAdapter
Dim msg As String
Dim title As String
Dim style As MsgBoxStyle
Dim response As MsgBoxResult
msg = "Are you sure you want to delete this activity?" ' Define message.
style = MsgBoxStyle.DefaultButton2 Or _
MsgBoxStyle.Critical Or MsgBoxStyle.YesNo
title = "Fit For TEST" ' Define title.
' Display message.
response = MsgBox(msg, style, title)
If response = MsgBoxResult.Yes Then ' User chose Yes.
'lblDebug.Text = drgFit.DataKeys(e.Item.ItemIndex())
dbConn.ConnectionString = Me.Application("DB_CONN_STRING")
dbCmd.CommandText = "procFIT_Person_Activity_Del"
dbCmd.CommandType = CommandType.StoredProcedure
dbCmd.Parameters.Add("@PersonID", Utilities.Login.GetLoggedOnUser(Me))
dbCmd.Parameters.Add("@PersonActivityID", drgFit.DataKeys(e.Item.ItemIndex()))
dbCmd.Connection = dbConn
dbConn.Open()
dbCmd.ExecuteNonQuery()
dbConn.Close()
fill_drgFit()
End If
This is what I get:
It is invalid to show a modal dialog or form when the application is not running in UserInteractive mode. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.
I think this has something to do with running a client side action, on a server side prog. what gives?
For future reference, this is what I found, and it works great!
Code:
Dim btn As System.Web.UI.WebControls.ImageButton
btn = e.Item.FindControl("btnDelete")
btn.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this item?');")
Actually all that code above is doing is appending javascript to the html of your page. It is not issuing a message box from the server side. It is not possible to popup a message box from the server side. Just letting you know.