ComponentOne GridView for ASP.NET WebForms
Task-Based Help / Client-Side Selection
In This Topic
    Client-Side Selection
    In This Topic

    This topic demonstrates how to enable client side selection and change the background color of selected rows, columns and cells of a C1GridView.

    In the Designer

    Complete the following steps to create a bound grid:

    1. Drag and drop a C1GridView control to your Web Form.
    2. Add data to the C1GridView. For more information, see Binding the Grid to a Data Source.
    3. Click OK.

    In Source View

    To change the background color of a single selected row, add ClientSelectionMode= "SingleRow" to the <c1:C1GridView> tag so that it appears similar to the following:

    <cc1:C1GridView ID="C1GridView1" runat="server" AutogenerateColumns="False" DataKeyNames="EmployeeID" DataSourceID="SqlDataSource1" ClientSelectionMode= "SingleRow">

    To define the background color, add the following code between the <head> </head> tag as shown below:

    <style type = "text/css">
    .wijmo-wijgrid .ui-state-highlight
    {
    background-color: Green!important;
    }
    </style>


    To change background color of multiple rows, add ClientSelectionMode = "MultiRow" to the <c1:C1GridView> tag and attach the CSS code as shown above. ClientSelectionMode property can also be set for cells or columns.

    What You've Accomplished

    When you run the project, the background color of the selected  rows are changed. To select multiple rows use the SHIFT or CTRL keys.


    See Also