Articles → LIGHT SWITCH 2011 → Convert checkbox nullable state to false in lightswitch 2011

Convert checkbox nullable state to false in lightswitch 2011






Objective of this Tutorial





Prerequisites





















Steps Involved









Step 1.: Create any screen (without selecting

Screen Data option)








Picture showing the popup for adding the Editable Grid Screen in the lightswitch application

Click to Enlarge







Picture showing a window for adding the new data item in the lightswitch screen

Click to Enlarge















Picture showing the different states of the checkbox in lightswitch screen

Click to Enlarge


Step 2. Add Code to eliminate nullable value of checkbox


Picture showing adding the checkbox changed event

Click to Enlarge





using System.Collections.Generic;
using Microsoft.LightSwitch;
namespace LightSwitchApplication {
  public partial class EditableGrid {
    partial void ChkTest_Changed() {
      if (ChkTest == null) ChkTest = false;
    }

    partial void EditableGrid_InitializeDataWorkspace(List < IDataService > saveChangesTo) {
      if (ChkTest == null) ChkTest = false;
    }
  }
}






Picture showing the checkbox nullable state is converted into false

Click to Enlarge


Posted By  -  Karan Gupta
 
Posted On  -  Monday, May 19, 2014

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250