locked
How can i do multiple selection in a grid RRS feed

  • Question

  • Hello everybody

    Can anybody help me that how can i do multiple selection inside a grid in lightswitch application.

     


    Rashmi Ranjan Panigrahi
    Thursday, August 25, 2011 8:43 AM

Answers

All replies

  • Babloo,

    This can be done by adding a checkbox column (field type boolean).  then you can use code (and buttons) to perform whatever action you want on the selected items.

    See example below:     


    Thursday, August 25, 2011 9:29 AM
  • Do keep in mind though,. that this is a workaround for missing functionality in the grid itself.

    You'll need to either clear the property values on loading, or on exiting, or else you may end up with results from a previous operation.


    Yann

    (plus ça change, plus c'est la même chose!)

    Thursday, August 25, 2011 11:21 AM
    Moderator
  • Hi

    Cromanti proposed solution is valid in a single-user deployment. But if need be used in multiuser concurrency issues can be found in the selection of records.

    Then as the Data Grid does not offer this functionality Lightswitch if critical to you, you must use custom controls.

    Jaime

    Thursday, August 25, 2011 2:07 PM
  • I don't believe that you *need* a custom control, although this is another option, but you do need to be careful to not actually persist the property values, both for the reason I mentioned earlier, & for concurrency, as Jaime pointed out.

    Each screen has it's own DataWorkspace, so the values will not affect someone else using the same screen in another running appalication, UNLESS the values are persisted to the database.

    You *can* use this workaround in multi-user scenarios, but you have to be *aware* of what could go wrong, & code for it accordingly.


    Yann

    (plus ça change, plus c'est la même chose!)

    Friday, August 26, 2011 1:16 AM
    Moderator
  • So bad there is no out-of-box support for this feature, this is such a generic requirement that almost every table is needed to be adding a bool checkbox column, so bad.
    Friday, August 26, 2011 1:53 AM
  • Hello RRP

    Yann Duran just put on MSDN code examples how to do multiple selection in grid: http://social.msdn.microsoft.com/Forums/en-US/lightswitch/thread/fc86aeb4-a107-43bb-9b9f-c4ab153c9a94

    I hope this help

    Spaso Lazarevic

     

    Friday, August 26, 2011 10:20 PM
  • Thanks Spaso. And I hope it helps too.

    Yann

    (plus ça change, plus c'est la même chose!)

    Friday, August 26, 2011 11:40 PM
    Moderator
  • Hi Ryan,

    I agree completely that this is a generic (& very basic) requirement.

    Thankfully, that workaround is no longer needed!

    See How To Enable Multiple Grid Row Selection.


    Yann

    (plus ça change, plus c'est la même chose!)

    Friday, August 26, 2011 11:42 PM
    Moderator
  • Yann I need to speak with you privately is there a way to email you?
    Derek
    Wednesday, September 28, 2011 6:24 PM
  • Absolutely - yann at live dot com dot au

    Yann

    (plus ça change, plus c'est la même chose!)

    If you found this post helpful, please "Vote as Helpful". If it actually answered your question, remember to "Mark as Answer".

    This will help people find the answers that they're looking for more quickly.

    Wednesday, September 28, 2011 11:02 PM
    Moderator