שאלה Running code on record change

  • Thursday, April 26, 2012 11:16 AM
     
     

    Hi

    I've got a Lightswitch Editable Grid and I would like to run a block of code when either:

    a) When a rows gets the focus, Or

    b) When a control in the row (like a dropdown or modal window) is clicked.

    Is that possible?

All Replies

  • Thursday, April 26, 2012 12:38 PM
     
     

    Hi

    You may try this


    Rashmi Ranjan Panigrahi

  • Thursday, April 26, 2012 1:40 PM
     
     

    Write you code in SelectionChanged of your Query (e.g. MyQuery)

    partial void MyQuery_SelectionChanged(){

    // write your code here

    }


    1+1 = 3 for large values of 1

  • Monday, April 30, 2012 9:18 AM
     
     

    Thanks

    I can't see a 'SelectionChanged' event.  I only have ExecuteFailed, Executed, Executing, PreporcessQuery and CanExecute.  I'm using LightSwitch for VS 2010.

  • Monday, April 30, 2012 9:20 AM
    Moderator
     
     
    If you select the collection on the screen that uses the query, the <CollectionName>_SelectionChanged method is available in the Write Code drop down.

    Justin Anderson, LightSwitch Development Team

  • Monday, April 30, 2012 10:45 AM
     
     

    Thanks.  Seems like the method runs when the Query Parameter is joined to the Screen Parameter - or when the 2 is linked to each other.

    For me it doesn't run for each row in the Gridview.  My query have a parameter that is bound to a 'Screen Parameter' Method.  I would however like the code to run when the drop down list is opened for each row in the gridview.  Currently it just runs on the 1st row.

    I kind off would like to auto refresh the items in the drowdown list for every row.

    Thanks for the help -  appreciate it.

  • Wednesday, May 02, 2012 11:08 AM
     
     

    Hi

    You may try this


    Rashmi Ranjan Panigrahi

    Thanks - but the problem does not seems to be the same as mine.

    I have looked at adding the event handler as suggested in the post, but there are not events that will help me.  ControlAvailable seems that it will only fire when the control becomes available for the first time.