0

I have a table with a many to many to many relashionship. I'm using this table as my screen data in a "New Data screen". When a user press the default add button (+), a dialog box pops up with 3 autocompleteboxes. I would like to hide/disable one of these autocompleteboxes based on the logged in users role/permission.

Is this possible or do i need to create a custom modal window? I'm really trying to avoid using custom modal windows =(

Thanks in advance

HiTech
  • 913
  • 1
  • 16
  • 34

1 Answers1

0

You can simply uncheck the "Open as Dialog" option in the Add/Edit screen to disable modal behaviour.

Re: permissions - you should also be able to define visibility filters based on the return value of your Application.Current.User.HasPermission(Permissions.) statement on the screen render/create event.

Hope that helps. :) UPDATE: Ah... sorry - misunderstood the question.

Something like this should get you up and running as required:

    using System;
    using System.Linq;
    using System.IO;
    using System.IO.IsolatedStorage;
    using System.Collections.Generic;
    using Microsoft.LightSwitch;
    using Microsoft.LightSwitch.Framework.Client;
    using Microsoft.LightSwitch.Presentation;
    using Microsoft.LightSwitch.Presentation.Extensions;
    namespace LightSwitchApplication
    {
        public partial class |ScreenName|
        {
            partial void |ScreenName|_Activated()
            {
                // Write your code here.
                if (Application.Current.User.HasPermission(Permissions.|CantReadLookupRole|))
                {
                    this.FindControl("LookupItem1").IsEnabled = false;
                }

            }
        }
    }

Where |CantReadLookupRole| is a placeholder for the role for which you want to disable the control and |ScreenName| is a placeholder for the name of the screen.

Ozziemedes
  • 311
  • 1
  • 6
  • Thanks for the reply @Ozziemedes. I really like the look and feel of the modal window and I'm trying to avoid removing it if i don't have to. I should have mentioned that in my post =\ – HiTech Sep 08 '14 at 18:01