I'd like to reference a row in the grid and select it on the client side.
Hello,
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); grid.get_behaviors().get_selection().get_selectedRows().add(gridRow); } </script>
<ig:WebDataGrid ID="WebDataGrid1" runat="server" AutoGenerateColumns="False" DataSourceID="AccessDataSource1" Height="350px" Width="400px"> <Behaviors> <ig:Selection> </ig:Selection> </Behaviors> <Columns> <ig:BoundDataField DataFieldName="EmployeeID" Key="EmployeeID"> <Header Text="EmployeeID" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="LastName" Key="LastName"> <Header Text="LastName" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="FirstName" Key="FirstName"> <Header Text="FirstName" /> </ig:BoundDataField> </Columns> </ig:WebDataGrid> <asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/App_Data/Nwind.mdb" SelectCommand="SELECT [EmployeeID], [LastName], [FirstName] FROM [Employees]"> </asp:AccessDataSource> <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:
http://help.infragistics.com/Help/NetAdvantage/NET/2008.3/CLR3.5/html/WebDataGrid~Infragistics.Web.UI.Selection~selectedRows.html