Open a screen after saving another screen in a LightSwitch Application


Introduction

As you know, Visual Studio LightSwitch is a Microsoft Technology. It is used to quickly build business applications for desktop and cloud. In the previous article I discussed about many tasks in a LightSwitch Application. In this article I will discuss about opening a screen after saving another screen in a LightSwitch application.

Step by Step solution 

First of all you create tables and screens in a LightSwitch application. For create the tables and screen in LightSwitch, Please refer this link http://www.c-sharpcorner.com/1/274/visual-studio-lightswitch-2011.aspx

Step 1: Click customer detail screen.

image1.gif

Step 2: Click write code->Select CustomerDetail_Saved->Write the below code.

image2.gif

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 CustomerDetail
    {
        partial void Customer_Loaded(bool succeeded)
        {
            // Write your code here.
            this.SetDisplayNameFromEntity(this.Customer);
        }
        partial void Customer_Changed()
        {
            // Write your code here.
            this.SetDisplayNameFromEntity(this.Customer);
        }
        partial void CustomerDetail_Saved()
        {
            // Write your code here.
            this.SetDisplayNameFromEntity(this.Customer);
            string answer = this.ShowInputBox("Please Enter a Value", "Enter Value");
            this.ShowMessageBox(answer);
            this.ShowMessageBox("Thanks for saving this Customer");
        }
        partial void OenOrders_Execute()
        {
            // Write your code here.
            this.Application.ShowOpenOrdersListDetail(this.Customer.Id);
        }
    }
}

Step 3: Run application->Open any Customer->Edit any field (like as city, state)->Save.

When click the save button then open a small window which shows blank textbox in which you will enter a value (customer name)->Ok.

image3.gif

Step 4: When you click the ok button then open a small window,which display customer name (which you entered)->Ok.

image4.gif

Step 5: When you click ok button then open a small window, which display thanks for saving customer.

image5.gif

Up Next
    Ebook Download
    View all
    Learn
    View all