iam trying to make edit mode activate after any postback or any page load but it doesnt seem like I can find a solution: I want to Activate the edit mode of the WebDataGrid and open the last row slected and opened row, when the user load the page .
i tried to get the current opened row and opened but it didn't work
var rowIndex = eventArgs.get_item().get_row().get_index(); var editingCore = row.get_grid().get_behaviors().get_editingCore(); var rowEditingTemplate = editingCore.get_behaviors().get_rowEditing(); rowEditingTemplate.enterEditMode(rowIndex);
Hi,
When you are using the RowEditing behavior the enterEditMode need as parameter a call. The row is parsed only for RowEditingTemplate.
You can modify your code to:
var row = eventArgs.get_item().get_row(); // Get for example firs cell in the row var cell = row.get_cell(0); var editingCore = row.get_grid().get_behaviors().get_editingCore(); var rowEditing = editingCore.get_behaviors().get_rowEditing(); rowEditing.enterEditMode(cell);
hi,
still don't work ,
here's what i am doing :
i double click in the grid and Editmode on the open and i update the data and save it and then page loads again
when page loads the last slected row still selected
i want that row selected to be opened (editcore)
what event i must trigger first and how to open automatically any row selected after any post back?
When you want to open the rowEditing on a selected row you can use the
Initialize client event of the WDG and to get the selected row and open it in edit mode. For example:
function WebDataGrid1_Grid_Initialize(sender, eventArgs) { var grid = $find('<%= WebDataGrid1.ClientID %>'); var selection = grid.get_behaviors().get_selection(); var selectedRows = selection.get_selectedRows(); if (selectedRows.get_length() > 0) { var row = selectedRows.getItem(0); // Get for example firs cell in the row var cell = row.get_cell(0); var editingCore = row.get_grid().get_behaviors().get_editingCore(); var rowEditing = editingCore.get_behaviors().get_rowEditing(); rowEditing.enterEditMode(cell); } }
I am sending you a sample where it works. Can you please modify it to your scenario to see why you have this error.
WDGOpenRowInEditMode.zip