asp.net - comparing the old values vs new value and update -
note: havent implement above solution closing question , accepting answer thou havent implement.
what best way of doing? , know can store repeater in different var , compare wanted know elegant way of doing.
here for loop
code want compare , update values have changed , ignore values have not changed
gridviewrow row = gv.selectedrow; repeater _rpt = gv.rows[e.rowindex].cells[8].findcontrol("rptreg") repeater; repeater _rpt1 = gv.rows[e.rowindex].cells[9].findcontrol("rptvisitor") repeater; (int = 0; < _rpt.items.count; i++) { textbox _txt = _rpt.items[i].findcontrol("txtid") textbox; textbox _txt1 = _rpt.items[i].findcontrol("txtname") textbox; if (_rpt1.items.count > i) textbox _txt3 = _rpt1.items[i].findcontrol("txtvisitor") textbox; //update db } }
it's total hack , i'm sure there more elegant way handle throw hidden field in there , set form elements onchange script update value of hidden field. check value of hidden field.
hopefully has better way if else fails.
if add class hidden field of "hiddenindicator" , form elements of "causeschanged" following jquery should want:
$(document).ready(function() { $('input.causeschanged').change(function() { $(this) .closest('tr') // parent row .find("input.hiddenindicator") // find children match selector .val('1'); //the value indicates change occured }); })
i haven't tested code used similar in project once.
Comments
Post a Comment