LightSwitch Tutorial – Create a Multi-Select Pick List

We’ll show you how you can easily create a pick list that allows selecting multiple items, work those items, show what’s selected when you go back into the pick list.  It’ll quickly become part of all your projects!

In this tutorial we show how to take our core project, and change the pick list for adding/removing permissions from Security Roles.  Allowing the Admin to remove/add permissions in one swoop vs. having to keep popping up a pick list for each.

So check it out at our tutorial site:  LightSwitch.CodeWriting.Tips

Here are the screen shots of what you’ll get, open the picker.


Select some items, click the save button.


Now open the picker back up, notice it preselects.  Go ahead and remove a couple and add others.



Tagged , ,

8 thoughts on “LightSwitch Tutorial – Create a Multi-Select Pick List

  1. Kivito says:

    Not directly related to this blog post, but just one great thanks! I’m around with lightswitch for a long time, but never was directly attached to javascript and html.. since things changes, your posts are great resources to me and my “head-desk” situations.. keep them coming!


  2. Miles says:

    Hi. Nice work. Followed the tut. but getting the following every time I click a permission to select/de-select:
    Exception is about to be caught by JavaScript library code at line 5, column 91437 in http://localhost:43910/App/Scripts/msls-2.5.2.min.js

    0x80004005 – JavaScript runtime error: Cannot execute command at this time.

    If there is a handler for this exception, the program may be safely continued.

    Once i continue, the selection saves fine.


  3. dwm9100b says:

    Sorry to hear you are having a problem. We’ll get you going tho.

    Most of the time this is a problem with the connection string for the security database that we pulled in and named formsSecurityData.

    If you are requiring SSL when you publish, the conx string for the security data service also needs to use HTTPS.

    Here is a sample of how your conx string should look

    • I think you forgot to post the sample. 🙂 I am not using SSL.

      This is what my current connection string looks like:
      service url=http://host/GoMobile/Microsoft.LightSwitch.SecurityData.svc;is windows authentication=False;allow invalid certificate=False

      Am I suppose to add the username and password into the connection string? It seems as though it is connecting to the security data service anonymously and not using the forms authentication details.

      • dwm9100b says:

        yep… sorry about that… 🙂

        name=”formsSecurityData” connectionString=”service url=http://{{root url of your app}}/Microsoft.LightSwitch.SecurityData.svc;is windows authentication=False;allow invalid certificate=False;user name={{user name of your app admin}};password={{password of the app admin}}”

      • Working! 🙂 Had UserName instead of User Name. Thanks dude! Loving your work.

  4. Hi, I have been trying to get your ‘Managing Users and Permissions’ tutorial working on a test server but am just not getting it right. It works perfectly when I run it locally but it doesn’t work when I publish it to a server. I am using Forms authentication and when I try and access the UserRegistrations on my Lightswitch HTML Client I get an IIS 7.5 401.0 Unauthorized error. And it says something like: Logon Method: Anonymous. The authenticated user does not have access to a resource needed to process the request. I just can’t figure out how to get this published correctly. Any help would be greatly appreciated.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: