How to show delete confirmation in LightSwitch
 
If you want to ask user before deleting record then write the following code in your screen code editor.
Namespace LightSwitchApplication
    Public Class EditableCustomersGrid
        Private Sub gridDeleteSelected_Execute()
            ' Write your code here.
            If ShowMessageBox("Are you sure you want to delete this record?", "Confirm Delete", MessageBoxOption.YesNo) = MessageBoxResult.Yes Then
                Dim cust As Customer
                cust = Me.Customers.SelectedItem
                If Customers.CanDelete Then
                    cust.Delete()
                    Me.Save() '//Save immediately ..
                End If
            End If
        End Sub
    End Class
End Namespace






Leave a Reply
You must be logged in to post a comment.