Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
How can I select a row via the csom?

I'd like to reference a row in the grid and select it on the client side.

  • 28464


    The idea is to use the newly introduced Behaviors collection and get the Selection behavior, then add the row you need to the selected rows collection using the add() method. Here is a sample approach:

        <script type="text/javascript">

            function selectRow()
                var grid = $find("<%= WebDataGrid1.ClientID %>");
                var gridRow = grid.get_rows().get_row(2);

         <ig:WebDataGrid ID="WebDataGrid1" runat="server" AutoGenerateColumns="False"
            DataSourceID="AccessDataSource1" Height="350px" Width="400px">
                <ig:BoundDataField DataFieldName="EmployeeID" Key="EmployeeID">
                    <Header Text="EmployeeID" />
                <ig:BoundDataField DataFieldName="LastName" Key="LastName">
                    <Header Text="LastName" />
                <ig:BoundDataField DataFieldName="FirstName" Key="FirstName">
                    <Header Text="FirstName" />
        <asp:AccessDataSource ID="AccessDataSource1" runat="server"
            SelectCommand="SELECT [EmployeeID], [LastName], [FirstName] FROM [Employees]">
        <asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="selectRow(); return false;"/>

    You can find more info on that in our online help, in the CSOM section of WebDataGrid: