Hello!
I would like to select the first row of a WebDataGrid upon load in javascript. I am calling the following function in the 'SelectionClientEvents -> Initialize' event.
function SelectRow(){var grid = document.getElementById('<%=wdgASNList.ClientID%>');var gridRow = grid.get_rows().get_row(0);grid.get_behaviors().get_selection().get_selectedRows().add(gridRow); }
I am receiving the "Object doesn't support this property or method" error at var gridRow = grid.get_rows().get_row(0);
Perhaps I am doing something wrong!
Thanks for all the help!
John
Hi,
In order to do this, handler the Grid's Initialize event instead, when you try to do it in the Selection's Initialize event, the behavior has not finished initializing yet. You can do this like so:
<ig:WebDataGrid ID="WebDataGrid1" runat="server" Width="400px" Height="400px"> <Behaviors> <ig:Selection RowSelectType="Multiple"> </ig:Selection> </Behaviors> <ClientEvents Initialize="GridInit" /> </ig:WebDataGrid>
function GridInit(grid, evntArgs){ var row = grid.get_rows().get_row(0); grid.get_behaviors().get_selection().get_selectedRows().add(row);}
Thank You,
Olga
great!, it helped!