I have a two tier VisualStudio C# Lightswitch application that i'd like to pass a variable from the client to server.
Problem:
When i try running my application the global variable global.WorkOrder
is always null. I've tried commenting out all the class references on the server and hardcoded a constant string into global.WorkOrder
on the client....but it remains null. Here's some code.
Client:
public partial class AddPart
{
partial void Input_Changed()
{
UserCode.Globals global = new UserCode.Globals();
global.WorkOrder = parts[7];
Server:
namespace LightSwitchApplication
{
public partial class DataService
{
partial void Instances_Inserted(Instance entity)
{
UserCode.Globals global = new UserCode.Globals();
InstanceInfo w = this.DataWorkspace.AUTOData.InstanceInfoes.AddNew();
w.InfoContent = global.WorkOrder;
I've also created a Class1 that lives on the server in a UserGroup folder. The class has been 'linked' on the client side.
Class:
namespace LightSwitchApplication.UserCode
{
public class Globals
{
public string WorkOrder { get; set; }
The code compiles without errors but something isn't correct. What am I doing wrong? Sorry for the beginner question, and please let me know if you need more information to help. Thanks!
public string Workorder = "Mike"
. This pushes Mike out to both client and server variable declarations, even though in the client i've gotglobal.WorkOrder = parts[7]
. parts[7] definitely has a value but global.Workorder is still not being written too on the client. – Ben Goldstein