Changing Display Name on the LightSwitch Editable Grid RRS feed

  • Question

  • Programmatically, how do I change the Display Name in a LightSwitch Data Grid.  In example below, the Display name is "NPR Data".  I need to change this thru code, for example, instead of NPR Data:

    Project: 115 (Motor)

    Is it also possible to add and ICON for cosmetic effect in the Display name? 

    Edward Piccoli

    Wednesday, November 6, 2013 12:27 PM


  • Hello

    This is fairly simple to do. In the _Loaded event of the data that you are loading into the grid enter the following code:-

    this.FindControl("Your_Grid_Name").DisplayName = "What You Want To Show!";

    Of course, you replace Your_Grid_Name with the name of the grid (i think NPRData in your case?) and What You Want To Show! with the text you want to show. You can add things to the displayname but remember anything you do needs to be .ToString() after :)


    If you found this post helpful, please mark it as helpful. If by some chance I answered the question, please mark the question as answered. That way you will help more people like me :)

    • Proposed as answer by Otis Ranger Wednesday, November 6, 2013 3:21 PM
    • Marked as answer by Yunjie Pei - MSFT Wednesday, November 13, 2013 5:16 AM
    Wednesday, November 6, 2013 3:21 PM