I am using UltraWebGrid from Infragistics for grid functionality in my ASP.NET 4.0 Application. I have enabled inplace editing for few columns in the grid. I wrote the logic for this event as
protected void UltraWebGrid_RowUpdating(object sender, RowUpdatingEventArgs e)
in code behind. Along with this I want to know which cell in the row triggered this event, meaning Updating which field in the row triggered this event. I found we have a Row property for RowUpdatingEventArgs Class but that gets the entire row. I want to know what cell, its column name etc.. in the row was dirty that made this event happen. Any useful pointers on this one?
RowUpdatingEventArgs
Pavan,
Are you sure your using the UltraWebGrid? I am asking because the UltraWebGrid doesn't have a RowUpdating event though the WebDataGrid does.
If you are using the WebDataGrid, you would be able to see what cells have been edited on the client side by using the EnteringEditMode and ExitingEditMode events. It would be up to you to store information about the cell that was edited and then get that information on the server in the RowUpdating event.
Let me know if you have any questions.
Ohh Yeah, I am using a WebDataGrid . But can you direct me with some sample on how to get the Edited Cells and their data from CLient to Server?
Thanks,
Hi I am using the following code as suggested in Infragistics documentation. In my UltrawebGrid_Init I have
"this.UltraWebGrid.Behaviors.EditingCore.Behaviors.CellEditing.CellEditingClientEvents.EnteredEditMode = "UltraWebGrid_EnteringCellEditMode";
On the client side(in .aspx) I have the Javascript..
function UltraWebGrid_EnteringCellEditMode(sender, e) { var cell = e.getCell(); var column = cell.get_column(); alert('Cell=' + cell + 'column=' + column); $("#MainContent_AssignedTo_ColName").val(column);}
but the alert box in the above function always displays '[object] [object]'
Why is it so? what am I missing here?
Hello,
Thank you for contacting us!
About your questions. It is possible to access edited, deleted and added rows collections from the EditingCore behavior, although currently it is not possible to get only the edited cells by design.
Code snippet:
ig_controls.WebDataGrid1.get_behaviors().get_editingCore().get_editedRows()
Based on the code snippet that you provided, I assume that you want to get the cell value and column key in order to show them with the Alert box. In order to achieve this you should use get_value() for the cell and get_key() for the column:
function UltraWebGrid_EnteringCellEditMode(sender, e) { var cell = e.getCell(); var column = cell.get_column(); alert('Cell=' + cell.get_value() + 'column=' + column.get_key()); $("#MainContent_AssignedTo_ColName").val(column.get_key());}
I just dont want to get the value in the CLient side using javaScript. I have a logic that changes based on the column name user is trying to edit. In other words , I need this column name to be accessible in Server Side's Row_Updating event as thats where my logic resides. Any pointers on how to do this?
Hello Pavan,
Thank you for the clarification.
As we are discussing in this forum post, you can try to use HiddenField which is accessible from both server and client sides.
Looking forward to hearing from you.