I have a Webdatagrid with a DropDownProvider for one column. Now the user can select a value with this DropDown editor. After that I want to change the values of two other rows depending on that selection.For that I tried to use the ExitedEditMode Event for the cell edited by the DropDown and got the new selected value of that cell. But I can get it working writing the new values in the other cells. May be I have to call an other function that the row is "refreshed". Can anybody give me a hint?
I'm using Visual Studio 2010 and NetAdvantage version 2010 Vol.3
Good to know, thanks!
If you look at my sample above, I wrote that you will get the old value with
cell.get_value() but if you use eventArgs.get_displayText() you will get the actual value. This is important because you have the option to cancel the event. Doing that this way the users cursor will not moveto the next cell and you don't have the need to set the focus manually back to the cell which has content that is false or not acceptable.
Hi there!
Thanks for your response, you lead me to the right path. It's actually the CellEditing_ExitedEditMode that I need here. The _ExitingEditMode is called before the _ValueChanged, so you will get the cell's old value when looking it up.
So the _CellValueChanged is called in between the ...Exiting... and ...Exited...
Keep up the good work!
Hi, I don't know exactly if my opinion is correct, but I think you are using an event that is not the right one to do that what you want. I think this event is called after every keystroke! Try it out and do only an "alert(..)" at this event.
But the goal is that if you now set a value in this event, it calls himself again..again... and so on.
I think you want to check a new value at that point when the user has done his input and will go to the next cell. The correct event for that would be Wdg1_CellEditing_ExitingEditMode. Here the user wants to exit, but is not really exited. That means the input is done, now you can check the input and change that as you want or to send a "cancel" it the input is not correct.
Gee, I am trying that too but I get a JScript error message stating that there is not enough stack memory. After my call to cell.set_value(...).
This is what I do:
function WebDataGrid1_Editing_CellValueChanged(sender, eventArgs) { var grid = $find("<%= WebDataGrid1.ClientID %>"); var row = eventArgs._cell._row; var value1 = 0; var value2 = 0; for (var j = 0; j < row.get_cellCount(); j++) { var cell = row.get_cell(j); var value = String(cell.get_value()).toLowerCase(); if (cell._column._key == "Value1") { value1 = parseInt(value); } else if (cell._column._key == "Value2") { value2 = parseInt(value); } else if (cell._column._key == "Result") { if (!isNaN(value1) && !isNaN(value2)) { var result = value1 + value2; cell.set_value(String(result)); } else { cell.get_element().innerHTML = "n/A"; } } } }
The debugger stops on a line in some auto-generated javascript file:
return function() { return method.apply(instance, arguments); //crash here }
Any idea?
Edit: Working with NetAdvantage 10.3, IE 8