WebGrid has capability to perform multiple selection without the need to
use checkboxes.
In this topic, you will learn how to enable Multiple Row Selection with keyboard
support.
To enable Multiple Row Selection with Keyboard Support
- Bind WebGrid
to AccessDataSource (Using Products table from NorthWind data source).
- Go to WebGrid's properties by pressing F4 on WebGrid control or you can simply right
click on WebGrid and choose Properties.
- Expand LayoutSettings and set AllowMultipleSelection
to Yes.
- By using keyboard combination of Ctrl, Shift and Click, you can perform multiple
row selection.
- Things to explore:
- Ctrl + Click. Try to hold Ctrl key and click on different random rows. The clicked
rows will become selected.
- Shift + Click. Try to click a row for the selection start. Then hold Shift key and
click on the destination row. The rows between start and destination selection will
become selected. You can do this in both upward and downward directin.
- Ctrl + Shift + Click. After you tried the above combination, you can hold Ctrl and
Shift at the same time, and click on the destination row. It enables you to select
a range of contagious rows while preserving the previous selection.
- Right click on the selection. A new menu item "Copy Selection" is now added when
there is active selection in WebGrid.