How do you get/set values from RowEditTemplate during onTemplateClosed client event using javascript? can someone share code with me? Thanks!
Hi Dave,
That code is wrong. You would use $get on its own.
var oInstrumentNbr = $get("Instrument_No").value; But, the id has to be the whole client id, since asp.net will give it a name containing parent ids. Or if you are using CLR 4, you could try setting id to static. Another option is to search through the child nodes of the ret template div. This can be found off of the ret behavior as ret._templateDiv. Then start searching childNodes collection to find your editors. But these will be straight html elements. If you have any of our controls, you'd be better off trying to find them with $find(id). You just need the client id. Hope this helps you out.
-Dave
I've tried the following code to retieve values from a textbox on the RowEdit Template but it doesn't work...what am I doing wrong?
function onTemplateClosing(sender, e) { var grid = sender; var ret = grid.get_behaviors().get_editingCore().get_behaviors().get_rowEditingTemplate(); var oInstrumentNbr = ret.$get({"Instrument_No"}).value;}
Hello davefevold,
Let us know if you need further assistance after the provided by David suggestion.
Hi davefevold,
By the time that the TemplateClosed event fires, the values will already have been carried to the row's cells. So you could check those cells. The row is available off of the event args. If you wanted to do validation to prevent the template closing, use the TemplateClosing event, then you'd have to find the objects using $get(id), $find(id), or document.getElementById(id) calls. Similar to what we do internally.
regards,
David Young