SIGN UP MEMBER LOGIN:    
ARTICLE

Pass a Parameter into a Screen from the Command Bar in a LightSwitch Application

Posted by Vineet Kumar Saini Articles | VS LightSwitch 2011 November 12, 2011
In this article, I will tell you how to Pass a Parameter into a Screen from the Command Bar in a LightSwitch Application.
Reader Level:

Pass a Parameter into a Screen from the Command Bar in a LightSwitch Application step by step :

Step 1: Right click on the  OrderHeader table->Add Query.

image1.gif

Step 2: Change query name (OpenOrders)->Add filter (ShippedDate is null)->Save like the below image.

image2.gif

Step 3: Add screen->List and Details screen->Select OpenOrder from screen data->Check OrderHeader->Ok.

image3.gif

Step 4: Now edit query of  OpenOrders->Add filter->Select CustomerID as parameter->Add new ID->Parameter (CustomerID) and type is Integer->Save.

image4.gif

Step 5: Click OpenOrderListDetail screen->AddDataItem->Local Property->Type (Integer)->Name (CustomerID)->Ok->Check parameter box.

image5.gif

Step 6: Click CustomerID of OpenOrder->Select Parameter Binding as CustomerID.

image6.gif

Step 7: Click CustomerDetail screen->Screen CommandBar->Add->New button->Write name (OpenOrder)->Ok.

image7.gif

Step 8: Now Choose image->Import image->Ok.

image8.gif

Step 9: Right click on OpenOrder->Edit Execute Code->Write the below code.

image9.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);
        }
        partial void OenOrders_Execute()
        {
            // Write your code here.
            this.Application.ShowOpenOrdersListDetail(this.Customer.Id)
        }
    }
}

Step 10: Run application->Open any customer->Click OpenOrder image->Design Screen->Customer property->Check show as a link->Save.

Step 11: Click OpenOrderListDetail screen->AddDataItem->Query->Select Customer_SinglrOrDefault->Ok.

image10.gif

Step 12 Click Id of Customer->Select Parameter Binding (CustomerID).

image11.gif

Step 13: Run application->Design screen->Add->AddNew>Move up first->Save.

image13.gif

Step 14: Click + sign in OpenOrder->Fill data->Save.

image14.gif

Login to add your contents and source code to this article
share this article :
post comment
 
Nevron Gauge for SharePoint
Become a Sponsor
PREMIUM SPONSORS
  • Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
    Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
Become a Sponsor