To invoke this mode, just call the client-side editRow method with parameter the ID (key) of the row to be edited inline. A typical way to do it is to make a row editable inline on click, using the OnClientRowSelect client-side event of the grid. Example:
<trirand:JQGrid ID="JQGrid1" runat="server" Width="600px" ShowToolBar="True" OnRowEditing="JQGrid1_RowEditing"> <Columns> <trirand:JQGridColumn DataField="EmployeeID" Editable="false" PrimaryKey="true" Width="50"/> <trirand:JQGridColumn DataField="FirstName" Editable="true" /> <trirand:JQGridColumn DataField="LastName" Editable="true" /> <trirand:JQGridColumn DataField="BirthDate" Editable="true" DataFormatString="{0:yyyy-MM-dd}" /> </Columns> <ClientSideEvents OnClientRowSelect="editRow" /> </trirand:JQGrid>
<script type="text/javascript"> var lastSelection; function editRow(id) { if (id && id !== lastSelection) { var grid = jQuery("#<%= JQGrid1.ClientID %>"); grid.restoreRow(lastSelection); grid.editRow(id, true); lastSelection = id; } } </script>
When end-users finish editing of the row in inline edit mode, the server-side RowEditing event is fired and you can proceed with edit logic as described in the RowEditing / RowEdited section of the help.