LightSwitch HTML Client (VS2013 Update 4) - how to hide column programmatically? RRS feed

All replies

  • Here is code snippet about hiding column based on user Permission                                 

    Imports Microsoft.LightSwitch.Threading
    Imports System.Windows.Controls

    Private _dataGrid As DataGrid

    Sub myScreen_InitializeDataWorkspace(saveChangesTo As System.Collections.Generic.List(Of Microsoft.LightSwitch.IDataService))
    AddHandler FindControl("Grid").ControlAvailable, AddressOf CONTROL_AVAILABLE

    PrivateSub CONTROL_AVAILABLE(sender AsObject, e As ControlAvailableEventArgs)

    IfTypeOf (e.Control) Is DataGrid Then
        _dataGrid = CType(e.Control, DataGrid)
    If Application.User.HasPermission(Permissions.SecurityAdministration) Then
         _dataGrid.Columns(0).Visibility = Windows.Visibility.Visible
         _dataGrid.Columns(0).Visibility = Windows.Visibility.Collapsed


    Tuesday, February 3, 2015 10:09 AM
  • Thanks for replying, but AFAICT that only works in the Silverlight client, not the HTML client?
    Tuesday, February 3, 2015 9:22 PM
  • look here   Blog from Beth Massi about geting user rights in HTML-client

    You will find an example at the bottom.


    • Edited by Helmut Seitz Wednesday, February 4, 2015 6:51 AM
    Wednesday, February 4, 2015 6:50 AM
  • AFAICT, that's for disabling an entire content item (in that case, a button for adding new customers), not for hiding a single property (column of a table) of a VisualCollection content item?

    If you linked to it because it's an example of fetching user rights, that was from sharpLj's sample.  I don't need fetching of user rights, my hiding of the column isn't permissions-based. :)

    Wednesday, February 4, 2015 12:11 PM