ผมใช้ฟังก์ชัน msgbox แบบ vb.net มันขึ้น errorว่า
Server Error in '/RmWeb' Application.
--------------------------------------------------------------------------------
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.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: 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.
Source Error:
Line 72:
Line 73: Private Sub cmdAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdAdd.Click
Line 74: If MsgBox("กรุณยืนยันการทำงาน.", MsgBoxStyle.OKCancel, "ยืนยันการทำงาน") = MsgBoxResult.OK Then
Line 75: Label1.Text = "บันทึก."
Line 76: End If
ตัวอย่างที่ code ที่เขียนไว้ในปุ่ม ไม่รู้ผิดตรงไหนครับ
Private Sub cmdAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdAdd.Click
If MsgBox("กรุณยืนยันการทำงาน.", MsgBoxStyle.OKCancel, "ยืนยันการทำงาน") = MsgBoxResult.OK Then
Label1.Text = "บันทึก."
End If
End Sub
Private Sub myGridView_RowDataBound(sender As Object, e As GridViewRowEventArgs)
Dim btnDelete As Button = CType(e.Row.FindControl("btnDelete"),Label)
IF Not IsNothing(btnDelete) Then
btnDelete.Attributes.Add("Onclick", "return confirm('Do you delete...?');")
End IF
End Sub