Thursday, 19 July 2012

Lightswitch: Get multi-selected items from DataGrid

This allows you to access all the selected items in the grid instead of just one (the SelectedItem property)
private const string Grid = "gridname";
private DataGrid _gridControl = null;
partial void Screen_InitializeDataWorkspace(List<IDataService> saveChangesTo)
{
    
this.FindControl(Grid).ControlAvailable +=
new EventHandler<ControlAvailableEventArgs
>(Grid_ControlAvailable);

}
void Grid_ControlAvailable(object sender, ControlAvailableEventArgs e)
{
_gridControl = e.Control
as DataGrid
;

if (_gridControl != null
)
_gridControl .SelectionMode =
DataGridSelectionMode.Extended;
}
partial void SomeAction_Execute()
{    
foreach (ObjectName e in
_gridControl.SelectedItems)     {         ...   
}

}

1 comment:

  1. Hello, Here You Can Download Bollywood Movies As Well As Hollywood Movies Also The Quality Of Movies Are Of HD
    Movie Download

    ReplyDelete