<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel xmlns:blog="http://www.dotnetnuke.com/blog/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
    <title>LightSwitch Help Website</title>
    <description>All about Microsoft Visual Studio Silverlight LightSwitch</description>
    <link>http://lightswitchhelpwebsite.com/Blog/tabid/61/BlogId/1/Default.aspx</link>
    <language>en-US</language>
    <webMaster>webmaster@adefwebserver.com</webMaster>
    <pubDate>Fri, 18 May 2012 06:27:17 GMT</pubDate>
    <lastBuildDate>Fri, 18 May 2012 06:27:17 GMT</lastBuildDate>
    <docs>http://backend.userland.com/rss</docs>
    <generator>Blog RSS Generator Version 4.0.0.0</generator>
    <item>
      <title>A LightSwitch Role Administration Web Page (JQueryUI/JuiceUI/Wijmo)</title>
      <link>http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/137/A-LightSwitch-Role-Administration-Web-Page-JQueryUI-JuiceUI-Wijmo.aspx</link>
      <description>&lt;p&gt;&lt;a href="http://lightswitch.adefwebserver.com/portals/0/blog/ca2162bcb0c3_12701/image.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lightswitch.adefwebserver.com/portals/0/blog/ca2162bcb0c3_12701/image_thumb.png" width="363" height="259" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Visual Studio LightSwitch&lt;/strong&gt; uses the standard &lt;strong&gt;ASP.NET&lt;/strong&gt; Membership provider. This allows you to create web applications that can manage the &lt;strong&gt;LightSwitch&lt;/strong&gt; users and roles. Integration with &lt;strong&gt;LightSwitch&lt;/strong&gt; and &lt;strong&gt;ASP.NET&lt;/strong&gt; has been covered in: &lt;a href="http://lightswitchhelpwebsite.comhttp://lightswitchhelpwebsite.comhttp://lightswitchhelpwebsite.comhttp://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/107/Integrating-LightSwitch-Into-An-ASPNET-Application-To-Provide-Single-Sign-On.aspx"&gt;Integrating LightSwitch Into An ASPNET Application To Provide Single Sign On&lt;/a&gt;. This article starts with the application created for that article, and adds an administration page that allows you to drag and drop roles, to assign and un-assign them for users.&lt;/p&gt;  &lt;h1&gt;The Application&lt;/h1&gt;  &lt;p&gt;&lt;a href="http://lightswitch.adefwebserver.com/portals/0/blog/ca2162bcb0c3_12701/image_3.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lightswitch.adefwebserver.com/portals/0/blog/ca2162bcb0c3_12701/image_thumb_3.png" width="239" height="197" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The page allows us to choose an existing member in the drop down.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lightswitch.adefwebserver.com/portals/0/blog/ca2162bcb0c3_12701/image_4.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lightswitch.adefwebserver.com/portals/0/blog/ca2162bcb0c3_12701/image_thumb_4.png" width="547" height="304" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The &lt;strong&gt;Roles&lt;/strong&gt; the user is in and not in will show. &lt;/p&gt;  &lt;p&gt;We can drag and drop the &lt;strong&gt;Roles&lt;/strong&gt; from each list to make a re-assignment.&lt;/p&gt;  &lt;p&gt;&lt;em&gt;(&lt;strong&gt;note:&lt;/strong&gt; the Administrator role cannot be unassigned to prevent a person from accidently un-assigning themselves as an administrator)&lt;/em&gt;&lt;/p&gt;  &lt;h1&gt;The ASP.NET Application&lt;/h1&gt;  &lt;p&gt;&lt;a href="http://lightswitch.adefwebserver.com/portals/0/blog/ca2162bcb0c3_12701/image_5.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lightswitch.adefwebserver.com/portals/0/blog/ca2162bcb0c3_12701/image_thumb_5.png" width="644" height="379" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;We will start with the code in: &lt;a href="http://lightswitchhelpwebsite.comhttp://lightswitchhelpwebsite.comhttp://lightswitchhelpwebsite.comhttp://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/107/Integrating-LightSwitch-Into-An-ASPNET-Application-To-Provide-Single-Sign-On.aspx"&gt;Integrating LightSwitch Into An ASPNET Application To Provide Single Sign On&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lightswitch.adefwebserver.com/portals/0/blog/ca2162bcb0c3_12701/image_6.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lightswitch.adefwebserver.com/portals/0/blog/ca2162bcb0c3_12701/image_thumb_6.png" width="644" height="363" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;This &lt;strong&gt;ASP.NET&lt;/strong&gt; website application can be pointed to any &lt;strong&gt;LightSwitch&lt;/strong&gt; application.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lightswitch.adefwebserver.com/portals/0/blog/ca2162bcb0c3_12701/image_7.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lightswitch.adefwebserver.com/portals/0/blog/ca2162bcb0c3_12701/image_thumb_7.png" width="408" height="427" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The &lt;strong&gt;ASP.NET&lt;/strong&gt; application allows users to create accounts and to log in.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lightswitch.adefwebserver.com/portals/0/blog/db735d9a0752_B12A/image_thumb30.png"&gt;&lt;img title="image_thumb[30]" border="0" alt="image_thumb[30]" src="http://lightswitch.adefwebserver.com/portals/0/blog/db735d9a0752_B12A/image_thumb30_thumb.png" width="489" height="178" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;We enable this by pointing the  &lt;strong&gt;web.config&lt;/strong&gt; settings of the &lt;strong&gt;ASP.NET&lt;/strong&gt; website application to the &lt;strong&gt;LightSwitch&lt;/strong&gt; application.&lt;/p&gt;  &lt;p&gt;For directions on how this is done see:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lightswitchhelpwebsite.comhttp://lightswitchhelpwebsite.comhttp://lightswitchhelpwebsite.comhttp://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/107/Integrating-LightSwitch-Into-An-ASPNET-Application-To-Provide-Single-Sign-On.aspx"&gt;Integrating LightSwitch Into An ASPNET Application To Provide Single Sign On&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Also see this post by &lt;strong&gt;LightSwitch&lt;/strong&gt; team member &lt;strong&gt;Valerie Andersen&lt;/strong&gt;: &lt;/p&gt;  &lt;p&gt;&lt;a href="http://social.msdn.microsoft.com/Forums/en-US/lightswitchgeneral/thread/60c76dde-07dd-48f7-8aed-f7aec66c47d4"&gt;http://social.msdn.microsoft.com/Forums/en-US/lightswitchgeneral/thread/60c76dde-07dd-48f7-8aed-f7aec66c47d4&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;a href="http://lightswitch.adefwebserver.com/portals/0/blog/ca2162bcb0c3_12701/image_8.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lightswitch.adefwebserver.com/portals/0/blog/ca2162bcb0c3_12701/image_thumb_8.png" width="539" height="59" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Also note that in addition to the &lt;strong&gt;web.config&lt;/strong&gt; changes, you will also need to change the line in the &lt;strong&gt;Default.aspx&lt;/strong&gt; file to point to your &lt;strong&gt;LightSwitch&lt;/strong&gt; application. &lt;/p&gt;  &lt;h1&gt;Creating The Application&lt;/h1&gt;  &lt;p&gt;&lt;a href="http://lightswitch.adefwebserver.com/portals/0/blog/ca2162bcb0c3_12701/image_9.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lightswitch.adefwebserver.com/portals/0/blog/ca2162bcb0c3_12701/image_thumb_9.png" width="451" height="115" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Open the code from: &lt;a href="http://lightswitchhelpwebsite.comhttp://lightswitchhelpwebsite.comhttp://lightswitchhelpwebsite.comhttp://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/107/Integrating-LightSwitch-Into-An-ASPNET-Application-To-Provide-Single-Sign-On.aspx"&gt;Integrating LightSwitch Into An ASPNET Application To Provide Single Sign On&lt;/a&gt; in Vis&lt;strong&gt;ual Studio 2010&lt;/strong&gt; (or higher).&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lightswitch.adefwebserver.com/portals/0/blog/ca2162bcb0c3_12701/image_10.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lightswitch.adefwebserver.com/portals/0/blog/ca2162bcb0c3_12701/image_thumb_10.png" width="263" height="301" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;You will see the files in the&lt;strong&gt; Solution Explorer&lt;/strong&gt; in &lt;strong&gt;Visual Studio&lt;/strong&gt;.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lightswitch.adefwebserver.com/portals/0/blog/ca2162bcb0c3_12701/image_11.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lightswitch.adefwebserver.com/portals/0/blog/ca2162bcb0c3_12701/image_thumb_11.png" width="644" height="442" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The sample we will create requires &lt;a href="http://jqueryui.com/"&gt;JQueryUI&lt;/a&gt;, &lt;a href="http://juiceui.com/"&gt;JuiceUI&lt;/a&gt; and &lt;a href="http://our.componentone.com/2012/02/28/goodbye-ajax-control-toolkit-hello-juice-ui/"&gt;Wijmo&lt;/a&gt;. The easiest way to install the needed components is to use &lt;strong&gt;Nuget&lt;/strong&gt;. &lt;/p&gt;  &lt;p&gt;If you have &lt;strong&gt;Visual Studio 2010&lt;/strong&gt; and you do not have &lt;strong&gt;Nuget&lt;/strong&gt; installed, install it from here:&lt;/p&gt;  &lt;p&gt;&lt;a title="http://nuget.org/" href="http://nuget.org/"&gt;http://nuget.org/&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;(note: if you have a higher version of &lt;strong&gt;Visual Studio&lt;/strong&gt;, it may already be installed).&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lightswitch.adefwebserver.com/portals/0/blog/ca2162bcb0c3_12701/image_12.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lightswitch.adefwebserver.com/portals/0/blog/ca2162bcb0c3_12701/image_thumb_12.png" width="614" height="311" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Open the &lt;strong&gt;Nuget&lt;/strong&gt; console by selecting: &lt;strong&gt;Tools&lt;/strong&gt; / &lt;strong&gt;Library Package Manager&lt;/strong&gt; / &lt;strong&gt;Package Manager Console&lt;/strong&gt;.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lightswitch.adefwebserver.com/portals/0/blog/ca2162bcb0c3_12701/image_13.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lightswitch.adefwebserver.com/portals/0/blog/ca2162bcb0c3_12701/image_thumb_13.png" width="456" height="216" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Type in:&lt;/p&gt;  &lt;p&gt;&lt;em&gt;&lt;strong&gt;Install-Package JuiceUI&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;and press the &lt;strong&gt;Enter&lt;/strong&gt; key.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lightswitch.adefwebserver.com/portals/0/blog/ca2162bcb0c3_12701/image_14.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lightswitch.adefwebserver.com/portals/0/blog/ca2162bcb0c3_12701/image_thumb_14.png" width="503" height="361" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The files will install.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lightswitch.adefwebserver.com/portals/0/blog/ca2162bcb0c3_12701/image_15.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lightswitch.adefwebserver.com/portals/0/blog/ca2162bcb0c3_12701/image_thumb_15.png" width="292" height="30" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Next, type in :&lt;/p&gt;  &lt;p&gt;&lt;em&gt;&lt;strong&gt;Install-Package WijmoOpenJuiceUI&lt;/strong&gt;&lt;/em&gt; &lt;/p&gt;  &lt;p&gt;and press the &lt;strong&gt;Enter&lt;/strong&gt; key.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lightswitch.adefwebserver.com/portals/0/blog/ca2162bcb0c3_12701/image_16.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lightswitch.adefwebserver.com/portals/0/blog/ca2162bcb0c3_12701/image_thumb_16.png" width="311" height="737" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;When you refresh the files n the &lt;strong&gt;Solution Explorer&lt;/strong&gt;, you will see that everything is installed (even the &lt;strong&gt;web.config&lt;/strong&gt; has been updated).&lt;/p&gt;  &lt;h1&gt;The Admin.aspx Page&lt;/h1&gt;  &lt;p&gt;&lt;a href="http://lightswitch.adefwebserver.com/portals/0/blog/ca2162bcb0c3_12701/image_17.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lightswitch.adefwebserver.com/portals/0/blog/ca2162bcb0c3_12701/image_thumb_17.png" width="798" height="448" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Next, we add a new page called &lt;strong&gt;Admin.aspx&lt;/strong&gt;.&lt;/p&gt;  &lt;p&gt;We use the following code for the markup:&lt;/p&gt;  &lt;pre&gt; &lt;/pre&gt;

&lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="background-color: #ffff00; color: black"&gt;&lt;%@ Page Language="C#" AutoEventWireup="true" CodeFile="Admin.aspx.cs" Inherits="Admin" %&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;html&lt;/span&gt; &lt;span style="color: #ff0000"&gt;xmlns&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"http://www.w3.org/1999/xhtml"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;html&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;head&lt;/span&gt; &lt;span style="color: #ff0000"&gt;id&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"Head1"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;runat&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"server"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;title&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;User Management&lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;title&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;head&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;body&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;form&lt;/span&gt; &lt;span style="color: #ff0000"&gt;id&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"form1"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;runat&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"server"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #c71585"&gt;asp&lt;/span&gt;:&lt;span style="color: #800000"&gt;ScriptManager&lt;/span&gt; &lt;span style="color: #ff0000"&gt;ID&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"ScriptManager1"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;runat&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"server"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #c71585"&gt;asp&lt;/span&gt;:&lt;span style="color: #800000"&gt;ScriptManager&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;style&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        .draggable
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            width: 100px;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            height: 50px;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        .droppable
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            width: 150px;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            height: 150px;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            padding-bottom: 2.0em;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            margin: 10px;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;style&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;style&lt;/span&gt; &lt;span style="color: #ff0000"&gt;type&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"text/css"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        .formdecorator label
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            display: block;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        .formdecorator
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            list-style: none;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            margin: 0;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            padding: 0;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        .formdecorator li
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            clear: both;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            margin-bottom: 1em;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;style&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;div&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;h4&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #c71585"&gt;asp&lt;/span&gt;:&lt;span style="color: #800000"&gt;Label&lt;/span&gt; &lt;span style="color: #ff0000"&gt;ID&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"lblTitle"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;runat&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"server"&lt;/span&gt; 
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                &lt;span style="color: #ff0000"&gt;Text&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"Visual Studio LightSwitch Role Manager (JQueryUI/JuiceUI/Wijmo)"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;h4&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;div&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #c71585"&gt;asp&lt;/span&gt;:&lt;span style="color: #800000"&gt;Panel&lt;/span&gt; &lt;span style="color: #ff0000"&gt;ID&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"pnlApplication"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;runat&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"server"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;table&lt;/span&gt; &lt;span style="color: #ff0000"&gt;class&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"formdecorator"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;tr&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;td&lt;/span&gt; &lt;span style="color: #ff0000"&gt;style&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"vertical-align: top"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;colspan&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"3"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                    &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;strong&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;User:&lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;strong&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                    &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                    &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #c71585"&gt;asp&lt;/span&gt;:&lt;span style="color: #800000"&gt;DropDownList&lt;/span&gt; &lt;span style="color: #ff0000"&gt;ID&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"ddlUsers"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;runat&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"server"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;AutoPostBack&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"True"&lt;/span&gt; 
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                        &lt;span style="color: #ff0000"&gt;ClientIDMode&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"Static"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;DataTextField&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"Text"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;DataValueField&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"Text"&lt;/span&gt; 
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                        &lt;span style="color: #ff0000"&gt;Width&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"200px"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                    &lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #c71585"&gt;asp&lt;/span&gt;:&lt;span style="color: #800000"&gt;DropDownList&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                    &lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                &lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;td&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;tr&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;tr&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;td&lt;/span&gt; &lt;span style="color: #ff0000"&gt;style&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"vertical-align: top"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;align&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"center"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                    &amp;nbsp;&lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;td&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;td&lt;/span&gt; &lt;span style="color: #ff0000"&gt;style&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"vertical-align: top"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                    &amp;nbsp;&lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;td&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;td&lt;/span&gt; &lt;span style="color: #ff0000"&gt;style&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"vertical-align: top"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;align&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"center"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                    &amp;nbsp;&lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;td&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;tr&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;tr&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;td&lt;/span&gt; &lt;span style="color: #ff0000"&gt;style&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"vertical-align: top"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                    &amp;nbsp;&lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;td&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;td&lt;/span&gt; &lt;span style="color: #ff0000"&gt;style&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"vertical-align: top"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                    &amp;nbsp;&lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;td&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;td&lt;/span&gt; &lt;span style="color: #ff0000"&gt;style&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"vertical-align: top"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                    &amp;nbsp;&lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;td&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;tr&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;table&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;div&lt;/span&gt; &lt;span style="color: #ff0000"&gt;id&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"Result"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;div&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #c71585"&gt;asp&lt;/span&gt;:&lt;span style="color: #800000"&gt;Panel&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;form&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;body&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;html&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;We use the following code for the code behind:&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.Collections.Generic;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.Linq;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.Web;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.Web.UI;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.Web.UI.WebControls;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.Net;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.Configuration;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.Web.Services;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.Web.Security;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt; Juice;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; partial &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; Admin : System.Web.UI.Page
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;{
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; DropDownText
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; Text { &lt;span style="color: #0000ff"&gt;get&lt;/span&gt;; &lt;span style="color: #0000ff"&gt;set&lt;/span&gt;; }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;protected&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; Page_Load(&lt;span style="color: #0000ff"&gt;object&lt;/span&gt; sender, EventArgs e)
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (User.Identity.IsAuthenticated) &lt;span style="color: #008000"&gt;// Logged in&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (!Page.IsPostBack)
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (Roles.IsUserInRole("&lt;span style="color: #8b0000"&gt;Administrator&lt;/span&gt;"))
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                    ShowUsers();
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                &lt;span style="color: #0000ff"&gt;else&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                    lblTitle.Text = "&lt;span style="color: #8b0000"&gt;Only Administrators can use this application&lt;/span&gt;";
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                    pnlApplication.Visible = &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;else&lt;/span&gt; &lt;span style="color: #008000"&gt;// Not Logged In&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            Response.Redirect("&lt;span style="color: #8b0000"&gt;~/Login.aspx&lt;/span&gt;");
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    #region ShowUsers
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; ShowUsers()
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        var colDropDownText = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; List&lt;DropDownText&gt;();
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;foreach&lt;/span&gt; (var item &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; Membership.GetAllUsers())
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            colDropDownText.Add(&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; DropDownText() { Text = item.ToString() });
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #008000"&gt;// Bind entire collection to GridView&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        ddlUsers.DataSource = colDropDownText;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        ddlUsers.DataBind();
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    #endregion
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;}&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;&lt;a href="http://lightswitch.adefwebserver.com/portals/0/blog/ca2162bcb0c3_12701/image_18.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lightswitch.adefwebserver.com/portals/0/blog/ca2162bcb0c3_12701/image_thumb_18.png" width="496" height="207" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When we run the application, log in, and navigate to the &lt;strong&gt;Admin.aspx&lt;/strong&gt; page, we see a drop down list of the users.&lt;/p&gt;

&lt;h1&gt;Display The Roles&lt;/h1&gt;

&lt;p&gt;Next, we add the following markup to display the &lt;strong&gt;Roles&lt;/strong&gt; a user is in (and not in):&lt;/p&gt;

&lt;pre&gt; &lt;/pre&gt;

&lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;tr&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;td&lt;/span&gt; &lt;span style="color: #ff0000"&gt;style&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"vertical-align: top"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #c71585"&gt;asp&lt;/span&gt;:&lt;span style="color: #800000"&gt;Panel&lt;/span&gt; &lt;span style="color: #ff0000"&gt;ID&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"UserRoles"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;CssClass&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"droppable ui-widget-header"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;runat&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"server"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;ClientIDMode&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"Static"&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                &lt;span style="color: #ff0000"&gt;Height&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"100%"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #c71585"&gt;asp&lt;/span&gt;:&lt;span style="color: #800000"&gt;DataList&lt;/span&gt; &lt;span style="color: #ff0000"&gt;ID&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"dlRoles"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;runat&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"server"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Width&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"100%"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                    &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;ItemTemplate&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                        &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #c71585"&gt;asp&lt;/span&gt;:&lt;span style="color: #800000"&gt;Panel&lt;/span&gt; &lt;span style="color: #ff0000"&gt;ID&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"DraggablePanel"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;runat&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"server"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;HorizontalAlign&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"Center"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                            &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;p&lt;/span&gt; &lt;span style="color: #ff0000"&gt;style&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"border: thin solid #C0C0C0; 
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                                padding: 5px; margin: 5px; cursor: hand; background-color: #FFFFCC;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                                font-weight: bold; width: 85%;"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                                &lt;span style="background-color: #ffff00; color: black"&gt;&lt;%&lt;/span&gt;# Eval("Text")&lt;span style="background-color: #ffff00; color: black"&gt;%&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;p&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                        &lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #c71585"&gt;asp&lt;/span&gt;:&lt;span style="color: #800000"&gt;Panel&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                    &lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;ItemTemplate&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                &lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #c71585"&gt;asp&lt;/span&gt;:&lt;span style="color: #800000"&gt;DataList&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #c71585"&gt;asp&lt;/span&gt;:&lt;span style="color: #800000"&gt;Panel&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;td&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;td&lt;/span&gt; &lt;span style="color: #ff0000"&gt;style&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"vertical-align: top"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &amp;nbsp;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;td&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;td&lt;/span&gt; &lt;span style="color: #ff0000"&gt;style&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"vertical-align: top"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #c71585"&gt;asp&lt;/span&gt;:&lt;span style="color: #800000"&gt;Panel&lt;/span&gt; &lt;span style="color: #ff0000"&gt;ID&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"AllRoles"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;CssClass&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"droppable ui-widget-header"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;runat&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"server"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;ClientIDMode&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"Static"&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                &lt;span style="color: #ff0000"&gt;Height&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"100%"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #c71585"&gt;asp&lt;/span&gt;:&lt;span style="color: #800000"&gt;DataList&lt;/span&gt; &lt;span style="color: #ff0000"&gt;ID&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"dlAllRoles"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;runat&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"server"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Width&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"100%"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                    &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;ItemTemplate&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                        &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #c71585"&gt;asp&lt;/span&gt;:&lt;span style="color: #800000"&gt;Panel&lt;/span&gt; &lt;span style="color: #ff0000"&gt;ID&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"DraggablePanel"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;runat&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"server"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;HorizontalAlign&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"Center"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                            &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;p&lt;/span&gt; &lt;span style="color: #ff0000"&gt;style&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"border: thin solid #C0C0C0; 
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                                padding: 5px; margin: 5px; cursor: hand; background-color: #FFFFCC;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                                font-weight: bold; width: 85%;"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                                &lt;span style="background-color: #ffff00; color: black"&gt;&lt;%&lt;/span&gt;# Eval("Text")&lt;span style="background-color: #ffff00; color: black"&gt;%&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;p&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                        &lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #c71585"&gt;asp&lt;/span&gt;:&lt;span style="color: #800000"&gt;Panel&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                    &lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;ItemTemplate&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                &lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #c71585"&gt;asp&lt;/span&gt;:&lt;span style="color: #800000"&gt;DataList&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #c71585"&gt;asp&lt;/span&gt;:&lt;span style="color: #800000"&gt;Panel&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;td&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;tr&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/pre&gt;

&lt;pre&gt; &lt;/pre&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;We use the following code behind to fill the lists:&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    #region DisplayRolesForUser
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; DisplayRolesForUser(&lt;span style="color: #0000ff"&gt;string&lt;/span&gt; UserName)
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        var colRolesForUser = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; List&lt;DropDownText&gt;();
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;foreach&lt;/span&gt; (var item &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; Roles.GetRolesForUser(UserName))
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            colRolesForUser.Add(&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; DropDownText() { Text = item.ToString() });
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #008000"&gt;// Bind entire collection to GridView&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        dlRoles.DataSource = colRolesForUser;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        dlRoles.DataBind();
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #008000"&gt;// Query OData source -- Roles&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        var RolesResult = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; List&lt;DropDownText&gt;();
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;foreach&lt;/span&gt; (var item &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; Roles.GetAllRoles())
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #0000ff"&gt;if&lt;/span&gt;(!Roles.IsUserInRole(UserName,item))
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                RolesResult.Add(&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; DropDownText() { Text = item.ToString() });
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            }            
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #008000"&gt;// Bind entire collection to GridView&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        dlAllRoles.DataSource = RolesResult;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        dlAllRoles.DataBind();
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    }  
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    #endregion   &lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;&lt;a href="http://lightswitch.adefwebserver.com/portals/0/blog/ca2162bcb0c3_12701/image_19.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lightswitch.adefwebserver.com/portals/0/blog/ca2162bcb0c3_12701/image_thumb_19.png" width="372" height="300" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When we run the application, the &lt;strong&gt;Roles&lt;/strong&gt; display.&lt;/p&gt;

&lt;h1&gt;Drag And Drop&lt;/h1&gt;

&lt;p&gt;&lt;a href="http://lightswitch.adefwebserver.com/portals/0/blog/ca2162bcb0c3_12701/image_20.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lightswitch.adefwebserver.com/portals/0/blog/ca2162bcb0c3_12701/image_thumb_20.png" width="720" height="191" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To enable &lt;strong&gt;drag&lt;/strong&gt;, we add &lt;strong&gt;JuiceUI &lt;/strong&gt;tags such as this:&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #c71585"&gt;juice&lt;/span&gt;:&lt;span style="color: #800000"&gt;Draggable&lt;/span&gt; &lt;span style="color: #ff0000"&gt;ID&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"DraggableControl"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;TargetControlID&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"DraggablePanel"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;runat&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"server"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Revert&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"true"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;&lt;a href="http://lightswitch.adefwebserver.com/portals/0/blog/ca2162bcb0c3_12701/image_21.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lightswitch.adefwebserver.com/portals/0/blog/ca2162bcb0c3_12701/image_thumb_21.png" width="802" height="308" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To enable &lt;strong&gt;drop&lt;/strong&gt; we also add &lt;strong&gt;JuiceUI&lt;/strong&gt; tags such as this:&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #c71585"&gt;juice&lt;/span&gt;:&lt;span style="color: #800000"&gt;Droppable&lt;/span&gt; &lt;span style="color: #ff0000"&gt;ID&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"Droppable1"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;TargetControlID&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"AllRoles"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;runat&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"server"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;We add the following &lt;strong&gt;JQuery&lt;/strong&gt; to handle the drop and call the &lt;strong&gt;UpdateRole&lt;/strong&gt; method (that will make the update to the user’s account):&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;$(&lt;span style="color: #0000ff"&gt;function&lt;/span&gt; () {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    $("&lt;span style="color: #8b0000"&gt;.droppable&lt;/span&gt;").droppable("&lt;span style="color: #8b0000"&gt;option&lt;/span&gt;", "&lt;span style="color: #8b0000"&gt;drop&lt;/span&gt;", &lt;span style="color: #0000ff"&gt;function&lt;/span&gt; (event, ui) {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; dropPanel = $(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;).attr("&lt;span style="color: #8b0000"&gt;id&lt;/span&gt;");
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; userName = $("&lt;span style="color: #8b0000"&gt;#ddlUsers option:selected&lt;/span&gt;").val();
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #008000"&gt;// Add element to the drop panel&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        $(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;).append(ui.draggable);
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #008000"&gt;// Get the text of the draggable item&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; roleName = "&lt;span style="color: #8b0000"&gt;&lt;/span&gt;";
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; ua = $.browser;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #008000"&gt;// Firefox uses textContent &lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #008000"&gt;// all others use innerText&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (ua.mozilla) {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            roleName = ui.draggable[0].textContent;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;else&lt;/span&gt; {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            roleName = ui.draggable[0].innerText;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #008000"&gt;// Set the text of the parameter to be passed to the web method&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; jsonText = JSON.stringify({ "&lt;span style="color: #8b0000"&gt;DropPanel&lt;/span&gt;": dropPanel, "&lt;span style="color: #8b0000"&gt;RoleName&lt;/span&gt;": roleName, "&lt;span style="color: #8b0000"&gt;UserName&lt;/span&gt;": userName });
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #008000"&gt;// Call the web method&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        $.ajax({
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            type: "&lt;span style="color: #8b0000"&gt;POST&lt;/span&gt;",
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            url: "&lt;span style="color: #8b0000"&gt;Admin.aspx/UpdateRole&lt;/span&gt;",
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            data: jsonText,
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            contentType: "&lt;span style="color: #8b0000"&gt;application/json; charset=utf-8&lt;/span&gt;",
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            dataType: "&lt;span style="color: #8b0000"&gt;json&lt;/span&gt;",
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            success: &lt;span style="color: #0000ff"&gt;function&lt;/span&gt; (msg) {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                &lt;span style="color: #008000"&gt;// Replace the div's content with the page method's return.&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                $("&lt;span style="color: #8b0000"&gt;#Result&lt;/span&gt;").text(msg.d);
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        });
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    });
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;});&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;We add the following static method to the code behind that will actually update the user’s account:&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    #region UpdateRole
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    [WebMethod]
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; UpdateRole(&lt;span style="color: #0000ff"&gt;string&lt;/span&gt; DropPanel, &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; RoleName, &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; UserName)
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; strResponse = "&lt;span style="color: #8b0000"&gt;&lt;/span&gt;";
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        Page objPage = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Page();
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #008000"&gt;// Must be logged in&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (objPage.User.Identity.IsAuthenticated)
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (Roles.IsUserInRole("&lt;span style="color: #8b0000"&gt;Administrator&lt;/span&gt;"))
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (DropPanel == "&lt;span style="color: #8b0000"&gt;UserRoles&lt;/span&gt;") &lt;span style="color: #008000"&gt;// Adding a role&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                    &lt;span style="color: #0000ff"&gt;try&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                    {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                        Roles.AddUserToRole(UserName, RoleName);
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                    }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                    &lt;span style="color: #0000ff"&gt;catch&lt;/span&gt; (Exception ex)
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                    {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                        strResponse = ex.Message;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                    }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                &lt;span style="color: #0000ff"&gt;else&lt;/span&gt; &lt;span style="color: #008000"&gt;// Removing a role&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                    &lt;span style="color: #0000ff"&gt;try&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                    {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                        Roles.RemoveUserFromRole(UserName, RoleName);
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                    }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                    &lt;span style="color: #0000ff"&gt;catch&lt;/span&gt; (Exception ex)
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                    {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                        strResponse = ex.Message;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                    }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; strResponse;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    #endregion&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt; &lt;/p&gt;

&lt;h1&gt;Prevent Administration Role From Being Dragged&lt;/h1&gt;

&lt;p&gt;&lt;a href="http://lightswitch.adefwebserver.com/portals/0/blog/ca2162bcb0c3_12701/image_22.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lightswitch.adefwebserver.com/portals/0/blog/ca2162bcb0c3_12701/image_thumb_22.png" width="269" height="81" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We want to prevent an administrator from accidently removing themselves from the &lt;strong&gt;Administrator&lt;/strong&gt; role.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://lightswitch.adefwebserver.com/portals/0/blog/ca2162bcb0c3_12701/image_23.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lightswitch.adefwebserver.com/portals/0/blog/ca2162bcb0c3_12701/image_thumb_23.png" width="789" height="322" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We add a hidden panel that will not be draggable and a &lt;strong&gt;onItemDataBound&lt;/strong&gt; event.&lt;/p&gt;

&lt;p&gt;We use the following code for the &lt;strong&gt;onItemDataBound&lt;/strong&gt; event:&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    #region dlRoles_ItemDataBound
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;protected&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; dlRoles_ItemDataBound(&lt;span style="color: #0000ff"&gt;object&lt;/span&gt; sender, DataListItemEventArgs e)
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #008000"&gt;// Get the data item&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        DropDownText objText = (DropDownText)e.Item.DataItem;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #008000"&gt;// Get an instance of the panels&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        Panel DraggablePanel = (Panel)e.Item.FindControl("&lt;span style="color: #8b0000"&gt;DraggablePanel&lt;/span&gt;");
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        Panel pnlAdministrator = (Panel)e.Item.FindControl("&lt;span style="color: #8b0000"&gt;pnlAdministrator&lt;/span&gt;");
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #008000"&gt;// If the data item is Administrator...&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (objText.Text == "&lt;span style="color: #8b0000"&gt;Administrator&lt;/span&gt;")
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #008000"&gt;// Hide the draggable panel&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            DraggablePanel.Visible = &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #008000"&gt;// Show the non draggable panel&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            pnlAdministrator.Visible = &lt;span style="color: #0000ff"&gt;true&lt;/span&gt;;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    } 
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    #endregion&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt; &lt;/p&gt;

&lt;h1&gt;Adding Wijmo&lt;/h1&gt;

&lt;p&gt;&lt;a href="http://lightswitch.adefwebserver.com/portals/0/blog/ca2162bcb0c3_12701/image_24.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lightswitch.adefwebserver.com/portals/0/blog/ca2162bcb0c3_12701/image_thumb_24.png" width="637" height="104" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To add the &lt;a href="http://our.componentone.com/2012/04/19/wijmo-open-for-juice-ui-beta/"&gt;Wijmo Open for JuiceUI&lt;/a&gt; control that will provide a theming, we only need to add a single line such as this:&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #c71585"&gt;wijmo&lt;/span&gt;:&lt;span style="color: #800000"&gt;WijDropdown&lt;/span&gt; &lt;span style="color: #ff0000"&gt;ID&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"Dropdown1"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;runat&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"server"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;TargetControlID&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"ddlUsers"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&gt;&lt;/span&gt; &lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;&lt;a href="http://lightswitch.adefwebserver.com/portals/0/blog/ca2162bcb0c3_12701/image_25.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lightswitch.adefwebserver.com/portals/0/blog/ca2162bcb0c3_12701/image_thumb_25.png" width="301" height="231" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When we run the application we see the dropdown has an attractive theme.&lt;/p&gt;

&lt;h1&gt;Download The Code&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;Download the code at:&lt;/strong&gt; &lt;a href="http://lightswitchhelpwebsite.com/Downloads.aspx"&gt;http://lightswitchhelpwebsite.comhttp://lightswitchhelpwebsite.com/Downloads.aspx&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;a href=http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/137/A-LightSwitch-Role-Administration-Web-Page-JQueryUI-JuiceUI-Wijmo.aspx&gt;More ...&lt;/a&gt;&lt;div class="tags"&gt;Tags: Advanced&lt;/div&gt;</description>
      <author>webmaster@adefwebserver.com</author>
      <comments>http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/137/A-LightSwitch-Role-Administration-Web-Page-JQueryUI-JuiceUI-Wijmo.aspx#Comments</comments>
      <slash:comments>0</slash:comments>
      <guid isPermaLink="true">http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/137/A-LightSwitch-Role-Administration-Web-Page-JQueryUI-JuiceUI-Wijmo.aspx</guid>
      <pubDate>Thu, 17 May 2012 13:59:29 GMT</pubDate>
      <trackback:ping>http://lightswitchhelpwebsite.comDesktopModules/BlogTrackback.aspx?id=137</trackback:ping>
      <blog:tag blog:url="http://lightswitchhelpwebsite.com/Blog/tabid/61/TagID/19/Default.aspx">Advanced</blog:tag>
    </item>
    <item>
      <title>The Southern California LightSwitch User Group May 2012 Meeting</title>
      <link>http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/136/The-Southern-California-LightSwitch-User-Group-May-2012-Meeting.aspx</link>
      <description>&lt;p&gt;&lt;a href="http://lightswitch.adefwebserver.com/portals/0/blog/668421e79eca_14E07/LSUserGroupMeeting.jpg"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="LSUserGroupMeeting" border="0" alt="LSUserGroupMeeting" src="http://lightswitch.adefwebserver.com/portals/0/blog/668421e79eca_14E07/LSUserGroupMeeting_thumb.jpg" width="244" height="184" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The first &lt;a href="http://lightswitchhelpwebsite.comhttp://lightswitchhelpwebsite.com/Community/SocialGroupDirectory/SocialGroupDetails/tabid/70/asg/6/Default.aspx"&gt;Southern California LightSwitch User’s Group&lt;/a&gt; meeting was a success. The group was formed a month ago after I made an announcement in the &lt;strong&gt;LightSwitch Help Website&lt;/strong&gt; forums: (&lt;a href="http://lightswitchhelpwebsite.com/Forum/tabid/63/aft/649/Default.aspx"&gt;Anyone want to form a Southern California LightSwitch User Group?&lt;/a&gt;). We had 7 members attend our first meeting.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;6:30pm&lt;/strong&gt; – Tom and I stopped by Target and picked up some chips, cookies, and crackers. At the next meeting we will order pizza, at this meeting we were not sure how many people would come and if we could eat a full meal in the conference room.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;7:00pm&lt;/strong&gt; – Most of the members have arrived. We decided to wait 10 minutes for anyone else to show up. People introduced themselves and passed out their cards if they had them. I asked some people if they were new to LightSwitch and half were.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;7:10pm&lt;/strong&gt; – I launched into a overview of LightSwitch for the new people, and talked about &lt;a href="http://lightswitchhelpwebsite.com/Blog/tabid/61/tagid/34/OData.aspx"&gt;OData&lt;/a&gt; and why it is so important. I ended up going longer than the 20 minutes I planned.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;7:50pm&lt;/strong&gt; – The next member hooked up to the projector and showed us the half completed application that will allow him to provide a loyalty card service to small businesses. He showed how he implemented computed fields, picture uploading, and multi-tenant filtering using this article: &lt;a href="http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/78/Levels-of-Validation-and-Filtering-on-User-Membership.aspx"&gt;Levels of Validation and Filtering on User Membership&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;8:15pm&lt;/strong&gt; – The next member hooked up his laptop and showed us a real estate application he is working on. He had some question on implementing custom filtering. We suggested he use: &lt;a href="http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/22/Using-The-LightSwitch-Filter-Extension.aspx"&gt;Using The LightSwitch Filter Extension&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;9:00pm&lt;/strong&gt; – The meeting breaks up. Five of us spend the next hour talking in the parking lot about our various projects.&lt;/p&gt;  &lt;h1&gt;Join The Group&lt;/h1&gt;  &lt;p&gt;You can join the group at this link: &lt;a href="http://lightswitchhelpwebsite.comhttp://lightswitchhelpwebsite.com/Community/SocialGroupDirectory/SocialGroupDetails/tabid/70/asg/6/Default.aspx"&gt;SoCal LightSwitch User Group&lt;/a&gt;.&lt;/p&gt;  &lt;h1&gt;Start Your Own Group&lt;/h1&gt;  &lt;p&gt;You can start your own group by &lt;a href="http://lightswitchhelpwebsite.com/Forum/tabid/63/aff/20/Default.aspx"&gt;making an announcement&lt;/a&gt; in the forums like I did. Once your group has formed, you can create a group on the &lt;strong&gt;LightSwitch Help Website&lt;/strong&gt; at: &lt;a title="http://lightswitchhelpwebsite.comhttp://lightswitchhelpwebsite.com/Community/SocialGroupDirectory.aspx" href="http://lightswitchhelpwebsite.com/Community/SocialGroupDirectory.aspx"&gt;http://lightswitchhelpwebsite.comhttp://lightswitchhelpwebsite.com/Community/SocialGroupDirectory.aspx&lt;/a&gt;.&lt;/p&gt;&lt;br /&gt;&lt;a href=http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/136/The-Southern-California-LightSwitch-User-Group-May-2012-Meeting.aspx&gt;More ...&lt;/a&gt;&lt;div class="tags"&gt;Tags: Community&lt;/div&gt;</description>
      <author>webmaster@adefwebserver.com</author>
      <comments>http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/136/The-Southern-California-LightSwitch-User-Group-May-2012-Meeting.aspx#Comments</comments>
      <slash:comments>0</slash:comments>
      <guid isPermaLink="true">http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/136/The-Southern-California-LightSwitch-User-Group-May-2012-Meeting.aspx</guid>
      <pubDate>Thu, 10 May 2012 07:05:18 GMT</pubDate>
      <trackback:ping>http://lightswitchhelpwebsite.comDesktopModules/BlogTrackback.aspx?id=136</trackback:ping>
      <blog:tag blog:url="http://lightswitchhelpwebsite.com/Blog/tabid/61/TagID/39/Default.aspx">Community</blog:tag>
    </item>
    <item>
      <title>Visual Studio LightSwitch and Windows Phone 7 OData Full CRUD Example</title>
      <link>http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/135/Visual-Studio-LightSwitch-and-Windows-Phone-7-OData-Full-CRUD-Example.aspx</link>
      <description>&lt;p&gt;&lt;a href="http://lightswitch.adefwebserver.com/portals/0/blog/8c8de57cd25b_C4A9/image.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lightswitch.adefwebserver.com/portals/0/blog/8c8de57cd25b_C4A9/image_thumb.png" width="353" height="484" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Visual Studio &lt;b&gt;LightSwitch &lt;/b&gt;(In &lt;b&gt;Visual Studio 11 Beta&lt;/b&gt;) allows you to access your &lt;b&gt;LightSwitch&lt;/b&gt; application via &lt;a href="http://go.microsoft.com/fwlink/?LinkId=234926"&gt;OData&lt;/a&gt;. This provides access to the security and business rules of your &lt;strong&gt;LightSwitch&lt;/strong&gt; application. &lt;/p&gt;  &lt;p&gt;In this article we will demonstrate using &lt;strong&gt;Windows Phone 7&lt;/strong&gt; to create an application that will cover &lt;strong&gt;&lt;u&gt;C&lt;/u&gt;&lt;/strong&gt;reating, &lt;strong&gt;&lt;u&gt;R&lt;/u&gt;&lt;/strong&gt;eading, &lt;strong&gt;&lt;u&gt;U&lt;/u&gt;&lt;/strong&gt;pdating, and &lt;strong&gt;&lt;u&gt;D&lt;/u&gt;&lt;/strong&gt;eleting data (otherwise known as &lt;strong&gt;CRUD&lt;/strong&gt;) in &lt;strong&gt;LightSwitch&lt;/strong&gt;… &lt;/p&gt;  &lt;div class="tags"&gt;Tags: OData&lt;/div&gt;</description>
      <author>webmaster@adefwebserver.com</author>
      <comments>http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/135/Visual-Studio-LightSwitch-and-Windows-Phone-7-OData-Full-CRUD-Example.aspx#Comments</comments>
      <slash:comments>10</slash:comments>
      <guid isPermaLink="true">http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/135/Visual-Studio-LightSwitch-and-Windows-Phone-7-OData-Full-CRUD-Example.aspx</guid>
      <pubDate>Sun, 06 May 2012 14:35:43 GMT</pubDate>
      <trackback:ping>http://lightswitchhelpwebsite.comDesktopModules/BlogTrackback.aspx?id=135</trackback:ping>
      <blog:tag blog:url="http://lightswitchhelpwebsite.com/Blog/tabid/61/TagID/34/Default.aspx">OData</blog:tag>
    </item>
    <item>
      <title>Using Visual Studio LightSwitch To Orchestrate A Unity 3D Game</title>
      <link>http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/134/Using-Visual-Studio-LightSwitch-To-Orchestrate-A-Unity-3D-Game.aspx</link>
      <description>&lt;p&gt;&lt;a href="http://lightswitch.adefwebserver.com/portals/0/blog/6d7d45d50a3f_C326/image.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lightswitch.adefwebserver.com/portals/0/blog/6d7d45d50a3f_C326/image_thumb.png" width="395" height="289" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Visual Studio LightSwitch&lt;/strong&gt; in &lt;strong&gt;Visual Studio 11&lt;/strong&gt; allows you to communicate directly with the &lt;strong&gt;LightSwitch&lt;/strong&gt; business layer (business rules, custom code, security), though &lt;strong&gt;OData&lt;/strong&gt;. This allows you to use &lt;strong&gt;LightSwitch&lt;/strong&gt; as the orchestrating control for any enterprise application or deployment. &lt;/p&gt;  &lt;p&gt;In this example, we will demonstrate, using &lt;strong&gt;Visual Studio LightSwitch&lt;/strong&gt;, an application to monitor and send messages to a &lt;strong&gt;&lt;a href="http://unity3d.com/"&gt;Unity 3D&lt;/a&gt;&lt;/strong&gt; online game… &lt;/p&gt;  &lt;div class="tags"&gt;Tags: OData&lt;/div&gt;</description>
      <author>webmaster@adefwebserver.com</author>
      <comments>http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/134/Using-Visual-Studio-LightSwitch-To-Orchestrate-A-Unity-3D-Game.aspx#Comments</comments>
      <slash:comments>1</slash:comments>
      <guid isPermaLink="true">http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/134/Using-Visual-Studio-LightSwitch-To-Orchestrate-A-Unity-3D-Game.aspx</guid>
      <pubDate>Mon, 30 Apr 2012 02:23:03 GMT</pubDate>
      <trackback:ping>http://lightswitchhelpwebsite.comDesktopModules/BlogTrackback.aspx?id=134</trackback:ping>
      <blog:tag blog:url="http://lightswitchhelpwebsite.com/Blog/tabid/61/TagID/34/Default.aspx">OData</blog:tag>
    </item>
    <item>
      <title>A LightSwitch Netflix OData Mash-up</title>
      <link>http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/133/A-LightSwitch-Netflix-OData-Mash-up.aspx</link>
      <description>  &lt;p&gt;&lt;a href="http://lightswitch.adefwebserver.com/portals/0/blog/A-LightSwitch-Netflix-OData-Mash-up_130D0/image_4.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lightswitch.adefwebserver.com/portals/0/blog/A-LightSwitch-Netflix-OData-Mash-up_130D0/image_thumb_4.png" width="566" height="165" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Consuming &lt;strong&gt;OData&lt;/strong&gt; in &lt;strong&gt;Visual Studio LightSwitch&lt;/strong&gt; in &lt;strong&gt;Visual Studio 2011&lt;/strong&gt; is very easy. When you consume an &lt;strong&gt;OData&lt;/strong&gt; service in &lt;strong&gt;LightSwitch&lt;/strong&gt;, its &lt;strong&gt;Entities&lt;/strong&gt; that you import behave like any other &lt;strong&gt;LightSwitch&lt;/strong&gt; data source (such as &lt;strong&gt;Internal Entities&lt;/strong&gt;, external&lt;strong&gt; SQL tables&lt;/strong&gt;, and &lt;strong&gt;WCF RIA Services&lt;/strong&gt;). This allows you to easily create mash-ups where you combine different data sources to create an application.&lt;/p&gt;  &lt;p&gt;In this example, we will create an application that allows us to add our own reviews to the movies in the &lt;strong&gt;Netflix&lt;/strong&gt; catalog…&lt;/p&gt;  &lt;div class="tags"&gt;Tags: OData&lt;/div&gt;</description>
      <author>webmaster@adefwebserver.com</author>
      <comments>http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/133/A-LightSwitch-Netflix-OData-Mash-up.aspx#Comments</comments>
      <slash:comments>0</slash:comments>
      <guid isPermaLink="true">http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/133/A-LightSwitch-Netflix-OData-Mash-up.aspx</guid>
      <pubDate>Tue, 24 Apr 2012 04:39:39 GMT</pubDate>
      <trackback:ping>http://lightswitchhelpwebsite.comDesktopModules/BlogTrackback.aspx?id=133</trackback:ping>
      <blog:tag blog:url="http://lightswitchhelpwebsite.com/Blog/tabid/61/TagID/34/Default.aspx">OData</blog:tag>
    </item>
    <item>
      <title>Flipping on LightSwitch article in SD Times</title>
      <link>http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/131/Flipping-on-LightSwitch-article-in-SD-Times.aspx</link>
      <description>&lt;p&gt;Finally a well written article that talks about LightSwitch (also I am quoted in it several times):&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Everyone’s aiming for the “citizen developer,” but lately that elusive customer has led Microsoft on a snipe hunt. With LightSwitch, the company has a rapid application development (RAD) tool, that no one—not even Redmond or its partners—seems to know quite what to do with...&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
Read the full article &lt;a href="http://www.sdtimes.com/FLIPPING_ON_LIGHTSWITCH/By_Alexandra_Weber_Morales/About_LIGHTSWITCH_and_MICROSOFT_and_VISUALSTUDIO/36550"&gt;at this link&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;/p&gt;&lt;br /&gt;&lt;a href=http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/131/Flipping-on-LightSwitch-article-in-SD-Times.aspx&gt;More ...&lt;/a&gt;</description>
      <author>webmaster@adefwebserver.com</author>
      <comments>http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/131/Flipping-on-LightSwitch-article-in-SD-Times.aspx#Comments</comments>
      <slash:comments>0</slash:comments>
      <guid isPermaLink="true">http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/131/Flipping-on-LightSwitch-article-in-SD-Times.aspx</guid>
      <pubDate>Mon, 23 Apr 2012 23:57:00 GMT</pubDate>
      <trackback:ping>http://lightswitchhelpwebsite.comDesktopModules/BlogTrackback.aspx?id=131</trackback:ping>
    </item>
    <item>
      <title>Shape Your LightSwitch OData Using WCF RIA Services</title>
      <link>http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/130/Shape-your-LightSwitch-OData-Using-WCF-RIA-Services.aspx</link>
      <description>&lt;p&gt;&lt;a href="http://lightswitch.adefwebserver.com/portals/0/blog/1e74dba2e46a_116FF/image.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lightswitch.adefwebserver.com/portals/0/blog/1e74dba2e46a_116FF/image_thumb.png" width="515" height="291" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The &lt;strong&gt;LightSwitch&lt;/strong&gt; &lt;strong&gt;Silverlight&lt;/strong&gt; screens allow you to easily group and total data. The &lt;strong&gt;LightSwitch&lt;/strong&gt; &lt;strong&gt;OData&lt;/strong&gt; services return one &lt;strong&gt;Entity&lt;/strong&gt; collection at a time. This makes grouping and totaling across &lt;strong&gt;Entity&lt;/strong&gt; collections difficult. Using &lt;strong&gt;WCF RIA Services&lt;/strong&gt; provides a clean elegant solution…&lt;/p&gt;  &lt;div class="tags"&gt;Tags: OData&lt;/div&gt;</description>
      <author>webmaster@adefwebserver.com</author>
      <comments>http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/130/Shape-your-LightSwitch-OData-Using-WCF-RIA-Services.aspx#Comments</comments>
      <slash:comments>0</slash:comments>
      <guid isPermaLink="true">http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/130/Shape-your-LightSwitch-OData-Using-WCF-RIA-Services.aspx</guid>
      <pubDate>Thu, 19 Apr 2012 05:37:14 GMT</pubDate>
      <trackback:ping>http://lightswitchhelpwebsite.comDesktopModules/BlogTrackback.aspx?id=130</trackback:ping>
      <blog:tag blog:url="http://lightswitchhelpwebsite.com/Blog/tabid/61/TagID/34/Default.aspx">OData</blog:tag>
    </item>
    <item>
      <title>DELORDSON Releases 6 Exciting New Shells</title>
      <link>http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/129/DELORDSON-Releases-6-Exciting-New-Shells.aspx</link>
      <description>&lt;p&gt;&lt;a href="http://lightswitch.adefwebserver.com/portals/0/blog/DELORDSON-Releases-6-New-Shells_DC18/image.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lightswitch.adefwebserver.com/portals/0/blog/DELORDSON-Releases-6-New-Shells_DC18/image_thumb.png" width="389" height="270" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Delordson&lt;/strong&gt; has released 6 new &lt;strong&gt;LightSwitch&lt;/strong&gt; Shells today:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://lightswitchhelpwebsite.comhttp://lightswitchhelpwebsite.com/Market/Shells/DELORDSONShells/TreeViewShell.aspx"&gt;LightSwitch Tree View Shell&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://lightswitchhelpwebsite.comhttp://lightswitchhelpwebsite.com/Market/Shells/DELORDSONShells/DefaultShell2012.aspx"&gt;LightSwitch Default Shell 2012&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://lightswitchhelpwebsite.comhttp://lightswitchhelpwebsite.com/Market/Shells/DELORDSONShells/DefaultShellTop2012.aspx"&gt;LightSwitch Default Shell Top 2012&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://lightswitchhelpwebsite.com/Market/Shells/DELORDSONShells/TabbedMenuShell.aspx"&gt;LightSwitch Tabbed Menu Shell&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://lightswitchhelpwebsite.com/Market/Shells/DELORDSONShells/TiledMenuShell.aspx"&gt;LightSwitch Tiled Menu Shell&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://lightswitchhelpwebsite.com/Market/Shells/DELORDSONShells/TouchStripMenuShell.aspx"&gt;LightSwitch Touch Strip Menu Shell&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;He also offers a special where you can buy all the Shells for one low price in the &lt;a href="http://lightswitchhelpwebsite.comhttp://lightswitchhelpwebsite.com/Market/Shells/DELORDSONShells/ShellPack.aspx"&gt;&lt;strong&gt;LightSwitch Shell Pack&lt;/strong&gt;&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; All Shells come in a &lt;strong&gt;LightSwitch 2010&lt;/strong&gt; version, and a &lt;strong&gt;LightSwitch in Visual Studio 2011 Beta&lt;/strong&gt; version.&lt;/p&gt;  &lt;h1&gt;Cracking The Code In Creating LightSwitch Shells&lt;/h1&gt;  &lt;p&gt;I have covered creating &lt;strong&gt;LightSwitch&lt;/strong&gt; Shells in: &lt;a href="http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/68/Creating-a-Minimal-LightSwitch-Shell.aspx"&gt;Creating a Minimal LightSwitch Shell&lt;/a&gt;, but that does not begin to handle the numerous issues required for a professional level &lt;strong&gt;LightSwitch&lt;/strong&gt; Shell. For a professional level &lt;strong&gt;LightSwitch&lt;/strong&gt; Shell, you must deal with showing validation and loading and switching screens (among other things). &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Delordson&lt;/strong&gt; has dedicated himself to unraveling the mysteries of the &lt;strong&gt;LightSwitch&lt;/strong&gt; Shell API. It is not uncommon for he and I to exchange 5-10 emails a day discussing technical issues related to &lt;strong&gt;LightSwitch&lt;/strong&gt;. I am pretty knowledgeable about many aspects of &lt;strong&gt;LightSwitch&lt;/strong&gt;, but, when discussing the inner workings of &lt;strong&gt;LightSwitch&lt;/strong&gt; Shells and Themes, I mostly just listen &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://lightswitch.adefwebserver.com/portals/0/blog/DELORDSON-Releases-6-New-Shells_DC18/wlEmoticon-smile.png" /&gt;.&lt;/p&gt;  &lt;p&gt;About 2 months ago he had a breakthrough, and discovered how to tap into the &lt;strong&gt;LightSwitch&lt;/strong&gt; core objects to handle validation, screen management, events, ect. (all undocumented of course) . This allows him to make high quality, rock solid Shells, that behave as good as the Default &lt;strong&gt;LightSwitch&lt;/strong&gt; Shells.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lightswitchhelpwebsite.comhttp://lightswitchhelpwebsite.com/Market/Shells/DELORDSONShells/DefaultShell.aspx"&gt;&lt;img alt="" src="/Portals/0/DefaultShellAd.png" width="224" height="254" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;He published a 28 page manual explaining how he cracked the code, and packaged it, and the source code to his version of the &lt;strong&gt;LightSwitch Default Shell&lt;/strong&gt;, in his product called &lt;a href="http://lightswitchhelpwebsite.comhttp://lightswitchhelpwebsite.com/Market/Shells/DELORDSONShells/DefaultShell.aspx"&gt;Default LightSwitch Shell&lt;/a&gt;.&lt;/p&gt;  &lt;h1&gt;My Favorite Shells&lt;/h1&gt;  &lt;p&gt;All his Shells are great, but I have my favorites:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lightswitch.adefwebserver.com/portals/0/blog/DELORDSON-Releases-6-New-Shells_DC18/image_3.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lightswitch.adefwebserver.com/portals/0/blog/DELORDSON-Releases-6-New-Shells_DC18/image_thumb_3.png" width="644" height="364" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lightswitchhelpwebsite.comhttp://lightswitchhelpwebsite.com/Market/Shells/DELORDSONShells/TreeViewShell.aspx"&gt;LightSwitch Tree View Shell&lt;/a&gt; - One advantage of being the primary tester and sounding board for &lt;strong&gt;Delordson&lt;/strong&gt;, is that I get to influence the end product. Notice how the logo in the upper left stretches across the top? That turned out to require a bit of effort on &lt;strong&gt;Delordson&lt;/strong&gt;’s part, but I think my constant whining about this being my favorite Shell (“except for that one small issue…”) helped to get this important feature in.&lt;/p&gt;  &lt;p&gt;I think that having a nested tree menu with images, makes it easy for the end-user to understand and navigate the application.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lightswitch.adefwebserver.com/portals/0/blog/DELORDSON-Releases-6-New-Shells_DC18/image_4.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lightswitch.adefwebserver.com/portals/0/blog/DELORDSON-Releases-6-New-Shells_DC18/image_thumb_4.png" width="644" height="363" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lightswitchhelpwebsite.comhttp://lightswitchhelpwebsite.com/Market/Shells/DELORDSONShells/DefaultShellTop2012.aspx"&gt;LightSwitch Default Shell Top 2012&lt;/a&gt; – &lt;strong&gt;Delordson&lt;/strong&gt; actually planned to make only 5 Shells. The reason there are 6 Shells in the &lt;a href="http://lightswitchhelpwebsite.comhttp://lightswitchhelpwebsite.com/Market/Shells/DELORDSONShells/ShellPack.aspx"&gt;&lt;strong&gt;LightSwitch Shell Pack&lt;/strong&gt;&lt;/a&gt;, is because my other favorite Shell was the &lt;a href="http://lightswitchhelpwebsite.comhttp://lightswitchhelpwebsite.com/Market/Shells/DELORDSONShells/DefaultShell2012.aspx"&gt;LightSwitch Default Shell 2012&lt;/a&gt; (inspired by the Cosmopolitan Shell that is to be the default Shell in the next version of LightSwitch), but I hated that the &lt;strong&gt;Save&lt;/strong&gt; and &lt;strong&gt;Refresh&lt;/strong&gt; buttons were at the bottom of the screen.&lt;/p&gt;  &lt;p&gt;The menu bar does not take up valuable screen space, and it still has the ever helpful icons to assist the end-user in understanding what a screen is suppose to do (and makes the application more attractive).&lt;/p&gt;&lt;br /&gt;&lt;a href=http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/129/DELORDSON-Releases-6-Exciting-New-Shells.aspx&gt;More ...&lt;/a&gt;&lt;div class="tags"&gt;Tags: Shells&lt;/div&gt;</description>
      <author>webmaster@adefwebserver.com</author>
      <comments>http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/129/DELORDSON-Releases-6-Exciting-New-Shells.aspx#Comments</comments>
      <slash:comments>0</slash:comments>
      <guid isPermaLink="true">http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/129/DELORDSON-Releases-6-Exciting-New-Shells.aspx</guid>
      <pubDate>Sun, 15 Apr 2012 23:32:54 GMT</pubDate>
      <trackback:ping>http://lightswitchhelpwebsite.comDesktopModules/BlogTrackback.aspx?id=129</trackback:ping>
      <blog:tag blog:url="http://lightswitchhelpwebsite.com/Blog/tabid/61/TagID/38/Default.aspx">Shells</blog:tag>
    </item>
    <item>
      <title>A Full CRUD DataJs and KnockoutJs LightSwitch Example Using Only An .Html Page</title>
      <link>http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/128/A-Full-CRUD-DataJs-and-KnockoutJs-LightSwitch-Example-Using-Only-An-Html-Page.aspx</link>
      <description>&lt;p&gt;&lt;a href="http://lightswitch.adefwebserver.com/portals/0/blog/ce8812b60d46_5EFE/image.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lightswitch.adefwebserver.com/portals/0/blog/ce8812b60d46_5EFE/image_thumb.png" width="354" height="354" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Visual Studio &lt;b&gt;LightSwitch &lt;/b&gt;(In &lt;b&gt;Visual Studio 11 Beta&lt;/b&gt;) allows you to access your &lt;b&gt;LightSwitch&lt;/b&gt; application via &lt;a href="http://go.microsoft.com/fwlink/?LinkId=234926"&gt;OData&lt;/a&gt;. This provides access to the security and business rules of your &lt;strong&gt;LightSwitch&lt;/strong&gt; application. &lt;/p&gt;  &lt;p&gt;In this article we will demonstrate using &lt;a href="http://jquery.com/"&gt;JQuery&lt;/a&gt;, &lt;a href="http://datajs.codeplex.com/"&gt;DataJs&lt;/a&gt; and &lt;a href="http://knockoutjs.com/"&gt;KnockoutJs&lt;/a&gt; to create a page that will cover &lt;strong&gt;&lt;u&gt;C&lt;/u&gt;&lt;/strong&gt;reating, &lt;strong&gt;&lt;u&gt;R&lt;/u&gt;&lt;/strong&gt;eading, &lt;strong&gt;&lt;u&gt;U&lt;/u&gt;&lt;/strong&gt;pdating, and &lt;strong&gt;&lt;u&gt;D&lt;/u&gt;&lt;/strong&gt;eleting data (otherwise known as &lt;strong&gt;CRUD&lt;/strong&gt;) in &lt;strong&gt;LightSwitch&lt;/strong&gt;. As described in the article: &lt;a href="http://blogs.msdn.com/b/lightswitch/archive/2012/03/22/lightswitch-architecture-odata.aspx"&gt;LightSwitch Architecture: OData (John Rivard)&lt;/a&gt;, OData allows &lt;strong&gt;CRUD&lt;/strong&gt; using the following &lt;strong&gt;HTTP verbs&lt;/strong&gt;:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;strong&gt;C&lt;/strong&gt;reate : POST       &lt;br /&gt;&lt;strong&gt;R&lt;/strong&gt;ead: GET       &lt;br /&gt;&lt;strong&gt;U&lt;/strong&gt;pdate: PUT       &lt;br /&gt;&lt;strong&gt;D&lt;/strong&gt;elete: DELETE&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Many may find that communication with &lt;strong&gt;LightSwitch&lt;/strong&gt; is easer when using the server side methods shown in the articles: &lt;a href="http://lightswitchhelpwebsite.comhttp://lightswitchhelpwebsite.comhttp://lightswitchhelpwebsite.comhttp://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/122/Calling-LightSwitch-2011-OData-Using-Server-Side-Code.aspx"&gt;Calling LightSwitch 2011 OData Using Server Side Code&lt;/a&gt; and &lt;a href="http://lightswitchhelpwebsite.comhttp://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/126/A-Full-CRUD-LightSwitch-JQuery-Mobile-Application.aspx"&gt;A Full CRUD LightSwitch JQuery Mobile Application&lt;/a&gt;. However, an advantage of using client-side &lt;strong&gt;JavaScript&lt;/strong&gt; is:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;You do not need to create a service reference &lt;/li&gt;    &lt;li&gt;You can place the code on a normal .html or .htm page &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;This disadvantage is that the code does not compile at &lt;em&gt;design-time&lt;/em&gt;, and one small typo can cause the page not to work. &lt;/p&gt;  &lt;h1&gt;The HTML Page In Action&lt;/h1&gt;  &lt;p&gt;&lt;a href="http://lightswitch.adefwebserver.com/portals/0/blog/ce8812b60d46_5EFE/image_3.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lightswitch.adefwebserver.com/portals/0/blog/ce8812b60d46_5EFE/image_thumb_3.png" width="650" height="553" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;When we run the application and navigate to the page, security (if enabled) is enforced.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lightswitch.adefwebserver.com/portals/0/blog/ce8812b60d46_5EFE/image_4.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lightswitch.adefwebserver.com/portals/0/blog/ce8812b60d46_5EFE/image_thumb_4.png" width="425" height="356" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The page will display the &lt;strong&gt;Products&lt;/strong&gt; and the &lt;strong&gt;edit&lt;/strong&gt; and &lt;strong&gt;delete&lt;/strong&gt; buttons to any valid user…&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lightswitch.adefwebserver.com/portals/0/blog/ce8812b60d46_5EFE/image_5.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lightswitch.adefwebserver.com/portals/0/blog/ce8812b60d46_5EFE/image_thumb_5.png" width="508" height="484" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;But, if a non-administrator tries to &lt;strong&gt;insert&lt;/strong&gt;, &lt;strong&gt;edit&lt;/strong&gt; or &lt;strong&gt;delete&lt;/strong&gt; records, &lt;strong&gt;LightSwitch&lt;/strong&gt; server-side security in the &lt;strong&gt;OData&lt;/strong&gt; feed, will enforce all business rules, and in this case prevent the user from performing the action.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lightswitch.adefwebserver.com/portals/0/blog/ce8812b60d46_5EFE/image_6.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lightswitch.adefwebserver.com/portals/0/blog/ce8812b60d46_5EFE/image_thumb_6.png" width="608" height="484" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Also, &lt;strong&gt;LightSwitch&lt;/strong&gt; returns &lt;em&gt;end-user understandable&lt;/em&gt; messages (you will want to parse the entire response to just show the &lt;strong&gt;Message&lt;/strong&gt; tags) for all validation errors. &lt;/p&gt;  &lt;h1&gt;DataJs and KnockoutJs&lt;/h1&gt;  &lt;p&gt;&lt;a href="http://lightswitch.adefwebserver.com/portals/0/blog/ce8812b60d46_5EFE/image_7.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lightswitch.adefwebserver.com/portals/0/blog/ce8812b60d46_5EFE/image_thumb_7.png" width="626" height="283" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;This sample uses &lt;strong&gt;DataJs&lt;/strong&gt; and &lt;strong&gt;KnockoutJs&lt;/strong&gt; (in addition to &lt;a href="http://jquery.com/"&gt;JQuery&lt;/a&gt;). &lt;/p&gt;  &lt;p&gt;Here are some links on &lt;strong&gt;DataJs&lt;/strong&gt; and &lt;strong&gt;KnockoutJs&lt;/strong&gt;:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://datajs.codeplex.com/"&gt;DataJs&lt;/a&gt; – This &lt;strong&gt;JavaScript&lt;/strong&gt; library is used to make the &lt;strong&gt;OData&lt;/strong&gt; calls into &lt;strong&gt;LightSwitch&lt;/strong&gt;. You can find documentation and samples &lt;a href="http://datajs.codeplex.com/documentation"&gt;at this link&lt;/a&gt;. Their &lt;a href="http://datajs.codeplex.com/wikipage?title=Simple%20CRUD%20Sample&amp;referringTitle=Documentation"&gt;Simple CRUD Sample&lt;/a&gt; is used as the basis for this article.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://knockoutjs.com/"&gt;KockoutJs&lt;/a&gt; – This &lt;strong&gt;JavaScript&lt;/strong&gt; library is used to display the data from &lt;strong&gt;DataJs&lt;/strong&gt;. It is recommended that you go through &lt;a href="http://learn.knockoutjs.com"&gt;these interactive tutorials&lt;/a&gt; to understand how it works. &lt;/p&gt;  &lt;h1&gt;LightSwitch OData Security&lt;/h1&gt;  &lt;p&gt;The sample consists of a page that allows an administrator to perform &lt;strong&gt;CRUD&lt;/strong&gt; operations on the &lt;strong&gt;Product&lt;/strong&gt; table in the &lt;strong&gt;Flower Shop&lt;/strong&gt; application used in the article: &lt;a href="http://lightswitchhelpwebsite.comhttp://lightswitchhelpwebsite.comhttp://lightswitchhelpwebsite.comhttp://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/122/Calling-LightSwitch-2011-OData-Using-Server-Side-Code.aspx"&gt;Calling LightSwitch 2011 OData Using Server Side Code&lt;/a&gt; .&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lightswitch.adefwebserver.com/portals/0/blog/ce8812b60d46_5EFE/image_8.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lightswitch.adefwebserver.com/portals/0/blog/ce8812b60d46_5EFE/image_thumb_8.png" width="630" height="432" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;First we need to prevent non-administrators from updating the &lt;strong&gt;Products&lt;/strong&gt; entity (table). We open the &lt;strong&gt;Products&lt;/strong&gt; entity and select the &lt;strong&gt;CanUpdate&lt;/strong&gt; method.&lt;/p&gt;  &lt;p&gt;We use the following code:&lt;/p&gt;  &lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        partial &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; FlowerShopProducts_CanUpdate(&lt;span style="color: #0000ff"&gt;ref&lt;/span&gt; &lt;span style="color: #0000ff"&gt;bool&lt;/span&gt; result)
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            result = &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Application.User.HasPermission(Permissions.SecurityAdministration);
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        }&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;We do the same for the &lt;strong&gt;CanDelete&lt;/strong&gt;  and &lt;strong&gt;CanInsert&lt;/strong&gt; methods:&lt;/p&gt;

&lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        partial &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; FlowerShopProducts_CanDelete(&lt;span style="color: #0000ff"&gt;ref&lt;/span&gt; &lt;span style="color: #0000ff"&gt;bool&lt;/span&gt; result)
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            result = &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Application.User.HasPermission(Permissions.SecurityAdministration);
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        partial &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; FlowerShopProducts_CanInsert(&lt;span style="color: #0000ff"&gt;ref&lt;/span&gt; &lt;span style="color: #0000ff"&gt;bool&lt;/span&gt; result)
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            result = &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Application.User.HasPermission(Permissions.SecurityAdministration);
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        }&lt;/pre&gt;&lt;/pre&gt;

&lt;h1&gt;The HTML Page&lt;/h1&gt;

&lt;p&gt;&lt;a href="http://lightswitch.adefwebserver.com/portals/0/blog/ce8812b60d46_5EFE/image_9.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lightswitch.adefwebserver.com/portals/0/blog/ce8812b60d46_5EFE/image_thumb_9.png" width="312" height="419" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The next thing we do is to switch to &lt;strong&gt;File View&lt;/strong&gt; mode and add the &lt;strong&gt;dataJs.htm&lt;/strong&gt; page and the &lt;strong&gt;.js&lt;/strong&gt; files required to support &lt;strong&gt;DataJs&lt;/strong&gt; and &lt;strong&gt;KnockoutJs&lt;/strong&gt;. We also need to unload the &lt;strong&gt;LightSwitch&lt;/strong&gt; project and add the pages to the project manifest. That process is covered in the article: &lt;a href="http://lightswitchhelpwebsite.comhttp://lightswitchhelpwebsite.comhttp://lightswitchhelpwebsite.comhttp://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/122/Calling-LightSwitch-2011-OData-Using-Server-Side-Code.aspx"&gt;Calling LightSwitch 2011 OData Using Server Side Code&lt;/a&gt;.&lt;/p&gt;

&lt;h1&gt;The Code&lt;/h1&gt;

&lt;p&gt;&lt;a href="http://lightswitch.adefwebserver.com/portals/0/blog/ce8812b60d46_5EFE/image_10.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lightswitch.adefwebserver.com/portals/0/blog/ce8812b60d46_5EFE/image_thumb_10.png" width="644" height="85" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For the top of the &lt;strong&gt;dataJa.htm&lt;/strong&gt; page we use the following code:&lt;/p&gt;

&lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;!DOCTYPE html&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;html&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;head&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;title&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;Products&lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;title&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;style&lt;/span&gt; &lt;span style="color: #ff0000"&gt;type&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"text/css"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #800000"&gt;body&lt;/span&gt; {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #ff0000"&gt;color&lt;/span&gt;: &lt;span style="color: #0000ff"&gt;#444444&lt;/span&gt;;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #ff0000"&gt;font-family&lt;/span&gt;: &lt;span style="color: #0000ff"&gt;Calibri, Verdana&lt;/span&gt;;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    .&lt;span style="color: #800000"&gt;titleSpan&lt;/span&gt; {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #ff0000"&gt;font-weight&lt;/span&gt;: &lt;span style="color: #0000ff"&gt;bold&lt;/span&gt;;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    .&lt;span style="color: #800000"&gt;sectionArea&lt;/span&gt; {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #ff0000"&gt;border&lt;/span&gt;: &lt;span style="color: #0000ff"&gt;1px solid gainsboro&lt;/span&gt;;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #ff0000"&gt;padding&lt;/span&gt;: &lt;span style="color: #0000ff"&gt;8px&lt;/span&gt;;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #ff0000"&gt;margin-bottom&lt;/span&gt;: &lt;span style="color: #0000ff"&gt;8px&lt;/span&gt;;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #ff0000"&gt;background-color&lt;/span&gt;:  &lt;span style="color: #0000ff"&gt;#f1edb9&lt;/span&gt;;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #ff0000"&gt;width&lt;/span&gt;: &lt;span style="color: #0000ff"&gt;50%&lt;/span&gt;;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    .&lt;span style="color: #800000"&gt;ideaBox&lt;/span&gt; {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #ff0000"&gt;cursor&lt;/span&gt;: &lt;span style="color: #0000ff"&gt;pointer&lt;/span&gt;;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #ff0000"&gt;padding-top&lt;/span&gt;: &lt;span style="color: #0000ff"&gt;8px&lt;/span&gt;;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #800000"&gt;#modelArea&lt;/span&gt; {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #ff0000"&gt;border&lt;/span&gt;: &lt;span style="color: #0000ff"&gt;1px solid gainsboro&lt;/span&gt;;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #ff0000"&gt;padding&lt;/span&gt;: &lt;span style="color: #0000ff"&gt;8px&lt;/span&gt;;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #ff0000"&gt;margin-bottom&lt;/span&gt;: &lt;span style="color: #0000ff"&gt;8px&lt;/span&gt;;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #800000"&gt;button&lt;/span&gt;, &lt;span style="color: #800000"&gt;input&lt;/span&gt;, &lt;span style="color: #800000"&gt;textarea&lt;/span&gt; { &lt;span style="color: #ff0000"&gt;font-family&lt;/span&gt;: &lt;span style="color: #0000ff"&gt;Calibri, Verdana&lt;/span&gt;; &lt;span style="color: #ff0000"&gt;font-size&lt;/span&gt;: &lt;span style="color: #0000ff"&gt;100%&lt;/span&gt;; }&lt;/pre&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;style&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;head&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;body&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;h1&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;Products&lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;h1&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;p&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;This page shows how to create / read / update / delete information from a LightSwitch OData service.
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;p&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;&lt;a href="http://lightswitch.adefwebserver.com/portals/0/blog/ce8812b60d46_5EFE/image_11.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lightswitch.adefwebserver.com/portals/0/blog/ce8812b60d46_5EFE/image_thumb_11.png" width="201" height="56" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, we add a &lt;strong&gt;DIV&lt;/strong&gt; that will display a message when the page is busy communicating with &lt;strong&gt;LightSwitch&lt;/strong&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;div&lt;/span&gt; &lt;span style="color: #ff0000"&gt;id&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;'newproductArea'&lt;/span&gt; &lt;span style="color: #ff0000"&gt;class&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"sectionArea"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;&lt;a href="http://lightswitch.adefwebserver.com/portals/0/blog/ce8812b60d46_5EFE/image_12.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lightswitch.adefwebserver.com/portals/0/blog/ce8812b60d46_5EFE/image_thumb_12.png" width="88" height="44" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then we put in the &lt;strong&gt;Refresh&lt;/strong&gt; button. This is a normal &lt;strong&gt;HTML&lt;/strong&gt; button except for the &lt;strong&gt;KnockoutJs&lt;/strong&gt; attributes that will trigger the “&lt;strong&gt;loadproducts&lt;/strong&gt;” &lt;strong&gt;JavaScript&lt;/strong&gt; method:&lt;/p&gt;

&lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;button&lt;/span&gt; &lt;span style="color: #ff0000"&gt;id&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"refreshButton"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;data&lt;/span&gt;-&lt;span style="color: #ff0000"&gt;bind&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"click: loadproducts, disable: communicating"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;Refresh&lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;button&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;We see that &lt;strong&gt;loadproducts&lt;/strong&gt; is a &lt;strong&gt;JavaScript&lt;/strong&gt; function that calls the &lt;strong&gt;LightSwitch&lt;/strong&gt; &lt;strong&gt;OData&lt;/strong&gt; service:&lt;/p&gt;

&lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #008000"&gt;// Discards all products and reloads them from the server.&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.loadproducts = &lt;span style="color: #0000ff"&gt;function&lt;/span&gt; () {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            makeRequest({ requestUri: serviceUri + "&lt;span style="color: #8b0000"&gt;FlowerShopProducts&lt;/span&gt;" }, &lt;span style="color: #0000ff"&gt;function&lt;/span&gt; (data) {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                that.products().splice(0, productsViewModel.products().&lt;span style="color: #0000ff"&gt;length&lt;/span&gt;);
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                $.each(data.results, &lt;span style="color: #0000ff"&gt;function&lt;/span&gt; (index, value) {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                    that.products.push(productModelToViewModel(value));
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                });
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            });
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        };&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;This is the &lt;strong&gt;makeRequest&lt;/strong&gt; method that the &lt;strong&gt;loadproducts&lt;/strong&gt; method invokes:&lt;/p&gt;

&lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #008000"&gt;// Make a request, setting the 'communicating' flag.&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; makeRequest = &lt;span style="color: #0000ff"&gt;function&lt;/span&gt; (request, success) {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        productsViewModel.communicating(&lt;span style="color: #0000ff"&gt;true&lt;/span&gt;);
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        $("&lt;span style="color: #8b0000"&gt;#messageBar&lt;/span&gt;").text("&lt;span style="color: #8b0000"&gt;Contacting server...&lt;/span&gt;").show();
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; OData.request(request, &lt;span style="color: #0000ff"&gt;function&lt;/span&gt; (data) {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            productsViewModel.communicating(&lt;span style="color: #0000ff"&gt;false&lt;/span&gt;);
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            $("&lt;span style="color: #8b0000"&gt;#messageBar&lt;/span&gt;").hide();
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            success(data);
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        }, &lt;span style="color: #0000ff"&gt;function&lt;/span&gt; (err) {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            productsViewModel.communicating(&lt;span style="color: #0000ff"&gt;false&lt;/span&gt;);
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            $("&lt;span style="color: #8b0000"&gt;#messageBar&lt;/span&gt;").hide();
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #0000ff"&gt;alert&lt;/span&gt;("&lt;span style="color: #8b0000"&gt;Error while contacting server: &lt;/span&gt;" + err.message + "&lt;span style="color: #8b0000"&gt; - &lt;/span&gt;" + JSON.stringify(err));
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        });
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    };&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;&lt;a href="http://lightswitch.adefwebserver.com/portals/0/blog/ce8812b60d46_5EFE/image_13.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lightswitch.adefwebserver.com/portals/0/blog/ce8812b60d46_5EFE/image_thumb_13.png" width="236" height="317" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The following is the &lt;strong&gt;DIV&lt;/strong&gt; and the template used to display the products:&lt;/p&gt;

&lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;div&lt;/span&gt; &lt;span style="color: #ff0000"&gt;id&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"productsArea"&lt;/span&gt; 
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #ff0000"&gt;data&lt;/span&gt;-&lt;span style="color: #ff0000"&gt;bind&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"template: { name: 'productTemplate', foreach: products }"&lt;/span&gt; 
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #ff0000"&gt;class&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"sectionArea"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;div&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;script&lt;/span&gt; &lt;span style="color: #ff0000"&gt;type&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"x-jquery-tmpl"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;id&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"productTemplate"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;div&lt;/span&gt; &lt;span style="color: #ff0000"&gt;class&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;'productBox'&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;{{if editing}}
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;input&lt;/span&gt; &lt;span style="color: #ff0000"&gt;type&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"text"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;data&lt;/span&gt;-&lt;span style="color: #ff0000"&gt;bind&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"value: ProductName"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;size&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"80"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;textarea&lt;/span&gt; &lt;span style="color: #ff0000"&gt;data&lt;/span&gt;-&lt;span style="color: #ff0000"&gt;bind&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"value: Description"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;cols&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"80"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;rows&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"4"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;textarea&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;input&lt;/span&gt; &lt;span style="color: #ff0000"&gt;type&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"text"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;data&lt;/span&gt;-&lt;span style="color: #ff0000"&gt;bind&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"value: Price"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;size&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"80"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;button&lt;/span&gt; &lt;span style="color: #ff0000"&gt;data&lt;/span&gt;-&lt;span style="color: #ff0000"&gt;bind&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"click: saveproduct, disable: communicating"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;Save&lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;button&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;{{else}}&lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;span&lt;/span&gt; &lt;span style="color: #ff0000"&gt;class&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;'titleSpan'&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;${ProductName}&lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;span&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    ${Description}&lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    $${Price}&lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;button&lt;/span&gt; &lt;span style="color: #ff0000"&gt;data&lt;/span&gt;-&lt;span style="color: #ff0000"&gt;bind&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"click: editproduct, disable: communicating"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;Edit&lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;button&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;  
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;{{/if}}
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;button&lt;/span&gt; &lt;span style="color: #ff0000"&gt;data&lt;/span&gt;-&lt;span style="color: #ff0000"&gt;bind&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"click: deleteproduct, disable: communicating"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;Delete&lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;button&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;br&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;div&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;script&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;(notice there are really two possible templates, a &lt;strong&gt;display template&lt;/strong&gt; and an &lt;strong&gt;edit template&lt;/strong&gt;, separated by the &lt;strong&gt;{{if editing}}&lt;/strong&gt; value)&lt;/p&gt;

&lt;p&gt;&lt;a href="http://lightswitch.adefwebserver.com/portals/0/blog/ce8812b60d46_5EFE/image_14.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lightswitch.adefwebserver.com/portals/0/blog/ce8812b60d46_5EFE/image_thumb_14.png" width="248" height="267" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When the &lt;strong&gt;Edit&lt;/strong&gt; button is clicked, the following code runs and sets the &lt;strong&gt;editing&lt;/strong&gt; flag to true, and the edit template is displayed for the &lt;strong&gt;Product&lt;/strong&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #008000"&gt;// Start editing an product.&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        model.editproduct = &lt;span style="color: #0000ff"&gt;function&lt;/span&gt; () {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.editing(&lt;span style="color: #0000ff"&gt;true&lt;/span&gt;);
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        };&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;When the &lt;strong&gt;Save&lt;/strong&gt; button is pressed this code runs:&lt;/p&gt;

&lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #008000"&gt;// Save the changes to the product.&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        model.saveproduct = &lt;span style="color: #0000ff"&gt;function&lt;/span&gt; () {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; that = &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; data = productViewModelToModel(that);
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; request = {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                requestUri: data.__metadata.uri,
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                headers: { "&lt;span style="color: #8b0000"&gt;If-Match&lt;/span&gt;": "&lt;span style="color: #8b0000"&gt; *&lt;/span&gt;" },
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                method: "&lt;span style="color: #8b0000"&gt;PUT&lt;/span&gt;",
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                data: data
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            };
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            makeRequest(request, &lt;span style="color: #0000ff"&gt;function&lt;/span&gt; (data) {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                that.editing(&lt;span style="color: #0000ff"&gt;false&lt;/span&gt;);
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            });
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        };&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;When the &lt;strong&gt;Delete&lt;/strong&gt; button is pressed this code runs:&lt;/p&gt;

&lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #008000"&gt;// Deletes this product from the server and removes it from the view model.&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        model.deleteproduct = &lt;span style="color: #0000ff"&gt;function&lt;/span&gt; () {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; that = &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; request = {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                requestUri: that.__metadata.uri(),
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                headers: { "&lt;span style="color: #8b0000"&gt;If-Match&lt;/span&gt;": "&lt;span style="color: #8b0000"&gt; *&lt;/span&gt;" },
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                method: "&lt;span style="color: #8b0000"&gt;DELETE&lt;/span&gt;"
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            };
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            makeRequest(request, &lt;span style="color: #0000ff"&gt;function&lt;/span&gt; (data) {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                productsViewModel.products.remove(that);
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            });
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        };&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;When a &lt;strong&gt;Product&lt;/strong&gt; is &lt;strong&gt;Inserted&lt;/strong&gt;, this code runs:&lt;/p&gt;

&lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #008000"&gt;// Adds the newproduct placeholder to the list and saves to the server.&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.addNewproduct = &lt;span style="color: #0000ff"&gt;function&lt;/span&gt; () {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; request = {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                requestUri: serviceUri + "&lt;span style="color: #8b0000"&gt;FlowerShopProducts&lt;/span&gt;",
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                Accept: "&lt;span style="color: #8b0000"&gt;application/json&lt;/span&gt;",
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                method: "&lt;span style="color: #8b0000"&gt;POST&lt;/span&gt;",
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                data: {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                    Id: that.newproduct.id(),
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                    ProductName: that.newproduct.productName(),
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                    Description: that.newproduct.description(),
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                    Price: that.newproduct.price()
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            };
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            makeRequest(request, &lt;span style="color: #0000ff"&gt;function&lt;/span&gt; (newItem) {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                that.newproduct.id("&lt;span style="color: #8b0000"&gt;Id&lt;/span&gt;");
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                that.newproduct.productName("&lt;span style="color: #8b0000"&gt;New product&lt;/span&gt;");
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                that.newproduct.description("&lt;span style="color: #8b0000"&gt;Product description&lt;/span&gt;");
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                that.newproduct.price("&lt;span style="color: #8b0000"&gt;Price&lt;/span&gt;");
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                that.products.push(productModelToViewModel(newItem));
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            });
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        };&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt; &lt;/p&gt;

&lt;h1&gt;An Important Note About SSL&lt;/h1&gt;

&lt;p&gt;A production application must run on a webserver that has SSL enabled. Otherwise, a hacker with a packet sniffer can easily get the data and the usernames and passwords of your users who are connecting to your site using public Wi-Fi access points or other unsecure networks.&lt;/p&gt;

&lt;h1&gt;Still… Use The Silverlight Screens When You Can&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;Silverlight&lt;/strong&gt; is not “dead”. In fact it provides the best, most efficient user experience. You will want to use the normal Silverlight screen whenever you can. For example, allow users to place and track orders using a web page, but use the LightSwitch Silverlight screens for customer service, inventory management, and other administration functions.&lt;/p&gt;

&lt;p&gt;The advantage of using &lt;strong&gt;LightSwitch&lt;/strong&gt; is that all business rules and security are maintained in one place.&lt;/p&gt;

&lt;h1&gt;Also See&lt;/h1&gt;

&lt;p&gt;&lt;a href="http://lightswitchhelpwebsite.comhttp://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/126/A-Full-CRUD-LightSwitch-JQuery-Mobile-Application.aspx"&gt;A Full CRUD LightSwitch JQuery Mobile Application&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://lightswitchhelpwebsite.comhttp://lightswitchhelpwebsite.comhttp://lightswitchhelpwebsite.comhttp://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/122/Calling-LightSwitch-2011-OData-Using-Server-Side-Code.aspx"&gt;Calling LightSwitch 2011 OData Using Server Side Code&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/127/Using-The-OData-Explorer-with-LightSwitch-OData.aspx"&gt;Using The OData Explorer with LightSwitch OData&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/118/Learn-How-To-Make-OData-Calls-In-LightSwitch-2011.aspx"&gt;Learn How To Make OData Calls In LightSwitch 2011&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/114/Accessing-Your-Visual-Studio-2011-LightSwitch-Application-Using-OData.aspx"&gt;Accessing Your Visual Studio 2011 LightSwitch Application Using OData&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;Download Code&lt;/h1&gt;

&lt;p&gt;The &lt;strong&gt;LightSwitch&lt;/strong&gt; project is available at:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://lightswitchhelpwebsite.com/Downloads.aspx"&gt;http://lightswitchhelpwebsite.comhttp://lightswitchhelpwebsite.com/Downloads.aspx&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;a href=http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/128/A-Full-CRUD-DataJs-and-KnockoutJs-LightSwitch-Example-Using-Only-An-Html-Page.aspx&gt;More ...&lt;/a&gt;&lt;div class="tags"&gt;Tags: OData&lt;/div&gt;</description>
      <author>webmaster@adefwebserver.com</author>
      <comments>http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/128/A-Full-CRUD-DataJs-and-KnockoutJs-LightSwitch-Example-Using-Only-An-Html-Page.aspx#Comments</comments>
      <slash:comments>2</slash:comments>
      <guid isPermaLink="true">http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/128/A-Full-CRUD-DataJs-and-KnockoutJs-LightSwitch-Example-Using-Only-An-Html-Page.aspx</guid>
      <pubDate>Sun, 15 Apr 2012 01:42:21 GMT</pubDate>
      <trackback:ping>http://lightswitchhelpwebsite.comDesktopModules/BlogTrackback.aspx?id=128</trackback:ping>
      <blog:tag blog:url="http://lightswitchhelpwebsite.com/Blog/tabid/61/TagID/34/Default.aspx">OData</blog:tag>
    </item>
    <item>
      <title>Using The OData Explorer with LightSwitch OData</title>
      <link>http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/127/Using-The-OData-Explorer-with-LightSwitch-OData.aspx</link>
      <description>&lt;p&gt;&lt;a href="http://lightswitch.adefwebserver.com/portals/0/blog/Using-The-OData-Explorer-with-LightSwitc_55EA/image.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lightswitch.adefwebserver.com/portals/0/blog/Using-The-OData-Explorer-with-LightSwitc_55EA/image_thumb.png" width="494" height="274" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;One tool that you can use to browse your &lt;strong&gt;LightSwitch in Visual Studio 2011 Beta&lt;/strong&gt; &lt;a href="http://lightswitchhelpwebsite.com/Blog/tabid/61/tagid/34/OData.aspx"&gt;OData&lt;/a&gt; feeds is &lt;a href="http://www.linqpad.net/"&gt;LinqPad&lt;/a&gt;. Another one is the &lt;a href="http://blogs.msdn.com/b/phaniraj/archive/2010/03/17/announcing-the-odata-explorer.aspx"&gt;Silverlight OData Explorer&lt;/a&gt;…&lt;/p&gt;  &lt;div class="tags"&gt;Tags: OData&lt;/div&gt;</description>
      <author>webmaster@adefwebserver.com</author>
      <comments>http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/127/Using-The-OData-Explorer-with-LightSwitch-OData.aspx#Comments</comments>
      <slash:comments>1</slash:comments>
      <guid isPermaLink="true">http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/127/Using-The-OData-Explorer-with-LightSwitch-OData.aspx</guid>
      <pubDate>Thu, 12 Apr 2012 13:43:56 GMT</pubDate>
      <trackback:ping>http://lightswitchhelpwebsite.comDesktopModules/BlogTrackback.aspx?id=127</trackback:ping>
      <blog:tag blog:url="http://lightswitchhelpwebsite.com/Blog/tabid/61/TagID/34/Default.aspx">OData</blog:tag>
    </item>
  </channel>
</rss>
