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
Ok, here is an example where I did it. I have a datagrid with many columns. If now one column is changed to a value that is not the string "Standard" I change the value of two other column fields in the same row.
function Wdg1_CellEditing_ExitingEditMode(sender, eventArgs) { ///<summary> /// If the a field in Column "Basename" is not "Standard" then set the values for columns "TextA" and "TextB" ///</summary> ///<param name="sender" type="Infragistics.Web.UI.WebDataGrid"></param> ///<param name="eventArgs" type="Infragistics.Web.UI.CancelEditModeEventArgs"></param> var answers; var grid; var cellName; var theVal; var cell = eventArgs.getCell(); cellName = cell.get_column().get_key(); //the next code row gets the wrong value, it is the former value not the actual selected!! //theVal = cell.get_value().toLowerCase(); //the actual selected value can be found in the eventArgs! theVal = eventArgs.get_displayText() if (cellName == "Basename") { if (theVal != "") { if (theVal != "standard") //if not Standard then set the default values { strReturn = searchWdg2(theVal); //here I do a "lookup" in another grid, you can also have these values already or do a query.... answers = strReturn.split(":"); //I get 2 values in one string separated by ":" and convert this to an array impBCell = cell.get_row().get_cellByColumnKey("TextA"); impBCell.set_value(answers[0]); //put in the first value of the array impFCell = cell.get_row().get_cellByColumnKey("TextB"); impFCell.set_value(answers[1]); //put in the second value of the array } } } }
function Wdg1_CellEditing_ExitingEditMode(sender, eventArgs) { ///<summary> /// If the a field in Column "Basename" is not "Standard" then set the values for columns "TextA" and "TextB" ///</summary> ///<param name="sender" type="Infragistics.Web.UI.WebDataGrid"></param> ///<param name="eventArgs" type="Infragistics.Web.UI.CancelEditModeEventArgs"></param> var answers; var grid; var cellName; var theVal; var cell = eventArgs.getCell(); cellName = cell.get_column().get_key(); //the next code row gets the wrong value, it is the former value not the actual selected!! //theVal = cell.get_value().toLowerCase(); //the actual selected value can be found in the eventArgs! theVal = eventArgs.get_displayText() if (cellName == "Basename") { if (theVal != "") { if (theVal != "standard") //if not Standard then set the default values { strReturn = searchWdg2(theVal); //here I do a "lookup" in another grid, you can also have these values already or do a query.... answers = strReturn.split(":"); //I get 2 values in one string separated by ":" and convert this to an array impBCell = cell.get_row().get_cellByColumnKey("TextA"); impBCell.set_value(answers[0]); //put in the first value of the array impFCell = cell.get_row().get_cellByColumnKey("TextB"); impFCell.set_value(answers[1]); //put in the second value of the array } } }
}
I have also attached this example as txt file, so you can download an better read. I hope this help you!
Martin,
Could you please share the code you've written to accomplish this?
Thanks
Never mind! I have figured out myself. I tried it a wrong way.It works using code like this:
cell.set_value(newValue)