
Partial Class GridViewCustomRows
    Inherits System.Web.UI.Page

    Protected Sub gvwCustomers_RowEditing(ByVal sender As Object, ByVal e As GridViewEditEventArgs)
        SwitchVisibleColumns(False)
    End Sub

    Protected Sub gvwCustomers_RowCancelingEdit(ByVal sender As Object, ByVal e As GridViewCancelEditEventArgs)
        SwitchVisibleColumns(True)
    End Sub

    Protected Sub gvwCustomers_RowUpdated(ByVal sender As Object, ByVal e As GridViewUpdatedEventArgs)
        SwitchVisibleColumns(True)
    End Sub

    Private Sub SwitchVisibleColumns(ByVal inReadOnlyMode As Boolean)
        gvwCustomers.Columns(1).Visible = inReadOnlyMode
        ' Pole FullName.
        gvwCustomers.Columns(2).Visible = Not inReadOnlyMode
        ' Pole NameStyle.
        gvwCustomers.Columns(3).Visible = Not inReadOnlyMode
        ' Pole Title.
        gvwCustomers.Columns(4).Visible = Not inReadOnlyMode
        ' Pole FirstName.
        gvwCustomers.Columns(5).Visible = Not inReadOnlyMode
        ' Pole MiddleName.
        gvwCustomers.Columns(6).Visible = Not inReadOnlyMode
        ' Pole LastName.
        gvwCustomers.Columns(7).Visible = Not inReadOnlyMode
        ' Pole Suffix.
        gvwCustomers.Columns(12).Visible = inReadOnlyMode
        ' Pole ModifiedDate.
        gvwCustomers.Columns(13).Visible = inReadOnlyMode
        ' Pole PasswordHash.
        gvwCustomers.Columns(14).Visible = inReadOnlyMode
        ' Pole PasswordSalt.
    End Sub


End Class
