Add username and password in LightSwitch modal window Application


Visual Studio LightSwitch is a Microsoft tool ,which is used for build the business application. If you want add user and word in modal window in LightSwitch application then you can do .

Step by step solution for create Username and word in Modal window.

Step 1 : Open visual studio LightSwitch->Create new table.

image1.png

Step 2 : Create table like as subscriber.

image2.png

Step 3 : Now we will add screen. Right click on screens->Add screen.

image3.png

Step 4 : Select editable grid screen->Select screen data (Subscriber)->Ok.

image4.png

Step 5 : Now add new group.

image5.png

Step 6 : Expand group->Select modal window.

image6.png

Step 7 : Move username and word from screen to modal window.

image7.png

Step 8 : Change group name and unmark isvisible.

image8.png

Step 9 : Add data item->Local property->Type (string)->Name (ReEnteredNewword)->Ok.

image9.png

Step 10 : Now move ReEnyeredNewword from screen to modal window.

image10.png

Step 11 : Again add data item->Local property->Type (Subscriber)->Name (NewSubscriber)->Ok.

image11.png

Step 12 : Right click on add in commandbar->Select override code.

image12.png


Code

  using System;
  using System.Linq;
  using System.IO;
  using System.IO.IsolatedStorage;
  using System.Collections.Generic;
  using Microsoft.LightSwitch;
  using Microsoft.LightSwitch.Framework.Client;
  using Microsoft.LightSwitch.Presentation;
  using Microsoft.LightSwitch.Presentation.Extensions;
  namespace LightSwitchApplication
  {
      public partial class EditableSubscribersGrid
  
    {
              
          partial void gridAddAndEditNew_Execute()
          {
              // Write your code here.
  
            this.OpenModalWindow("AddSubscriber");
          }
      }

}

Step 13 : Run application (Press F5).You will see a new window of username and word.

image13.png

Step 14 : If you want add and edit username and word then you can do.

Code

  using System;
  using System.Linq;
  using System.IO;
  using System.IO.IsolatedStorage;
  using System.Collections.Generic;
  using Microsoft.LightSwitch;
  using Microsoft.LightSwitch.Framework.Client;
  using Microsoft.LightSwitch.Presentation;
  using Microsoft.LightSwitch.Presentation.Extensions;
  namespace LightSwitchApplication
  {
      public partial class EditableSubscribersGrid
  
    {
          partial void gridAddAndEditNew_Execute()
          {
              // Write your code here
  
            NewSubscriber = new Subscriber();
              ReEnteredNewword = String.Empty;
              this.OpenModalWindow(ADD_SUBSCRIBER_WINDOW);
              this.FindControl(ADD_SUBSCRIBER_WINDOW).ControlAvailable +=
               new EventHandler<ControlAvailableEventArgs>(NewSubscriber_WindowAvailable);
          }
      }
  }

Step 15 : Run application (Press F5). Now you can add and edit username and word. 

image14.png


Similar Articles