Message box in ASP.Net with VB.Net

Hi,

Im using VB.Net with ASP.Net and when I click a button, i would like a message box to come up with 'Yes' and 'No' before the button does it's action.  But this produces an error.  The code is below:

_____________________________________________________________________________________________

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        'Create message box
        Dim Msg, style, title, response
        Msg = "Quit BAS Calculator?"
        style = vbYesNo
        title = "System Message"
        response = MsgBox(Msg, style, title)

        If response = vbYes Then
            'Clear all rows corresponding to the rep where e has been set to indicate that the row was edited
            Dim updateCmd As String
            updateCmd = "UPDATE KG_Forecast SET Edit = '' WHERE Rep LIKE '" & Session("UserID") & "'"
            Dim myCommand As SqlCommand
            myCommand = New SqlCommand(updateCmd, myConnection)
            Dim CurrentTextBox As System.Web.UI.WebControls.TextBox
            myCommand.Connection.Open()
            Try
                myCommand.ExecuteNonQuery()
                dgProducts.EditItemIndex = -1
            Catch exp As Exception
                lblMessage.Text = "ERROR: " & exp.Message
            End Try
            myCommand.Connection.Close()

            BindGrid("ID")
        End If
    End Sub
_____________________________________________________________________________________________

Can anyone help???

Thanks in advance,

JK
jakekulaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mmarinovCommented:
Hi jakekula,

you have to use javscript to do that. There is a lot stuf on the net
check these articles :
http://aspnet.4guysfromrolla.com/articles/021104-1.aspx ( vb )

http://www.codeproject.com/aspnet/NingLiangSimpleControl.asp
http://p2p.wrox.com/topic.asp?TOPIC_ID=10194



Regards!
B..M
mmarinov
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
dnoxsCommented:
To get a messagebox to display use javascript:

If Not IsPostBack Then
    Button1.Attributes.Add("onclick", "javascript:if (confimr('UPDATE?')) { location='smapepage.aspx?action=update'; } else { alert('Not Confirmed'); } ");
End If

Very simple but gives you a quick idea of how you might do it
0
mmarinovCommented:
dnoxs,
just a correction - there is a typo :

it is not confimr but confirm function

Regards!
B..M
mmarinov
0
dnoxsCommented:
Thanks! Was in a bit of a hurry!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.