ARTICLE

Open a screen after saving another screen in a LightSwitch Application

Posted by Vineet Kumar Saini Articles | LightSwitch 2012 November 23, 2011
In this article we will discuss about the messagebox and inputbox for opening a screen after saving another screen in LoghtSwitch.
Reader Level:

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

Login to add your contents and source code to this article
post comment
     
COMMENT USING
PREMIUM SPONSORS
Over-C is a holistic consortium of communications and technology specialists. We build, deploy and market both business as well as consumer products and solutions.
Get Career Advice from Experts
SPONSORED BY
  • PDF reports have never been easier to create. With our included WYSIWYG Designer, you can layout your reports, set up your data source and let DynamicPDF ReportWriter do the rest.
Get Career Advice from Experts