c# - Specifying rowfilter criteria to be evaluated in DataTable event handlers -
we have mini business application framework of our own meet our custom needs. using datatables in our business classes storing collections (e.g. detail data). our framework identifies datatable type properties declared in business object , attaches few event handlers provide services authorization control, change tracking etc. things running fine today small requirement got me little baffled.
apart authorization requirements e.g. role based access edit datatable, edit columns of datatable etc., our devs require specify criteria datatable , matching rows (fulfilling criteria) prevented editing.
for example if there datatable having values below -
settingname | value | ispolicycontrolled
setting1 | 10 | false
setting2 | 20 | true
the devs want specify criteria through our business framework below -
somebusinessobject.makereadonly("settings", "ispolicycontrolled == true");
the first parameter being datatable name , second criteria readonly rows. framework developer duty prevent editing in rows match specified condition.
for can attach event handler datatable monitor changes being made, e.g. can handle rowchanging monitor change being made. need verify whether row being changed matches specified condition.
if (rowmatchescondition(e.row)) // block changes
now find no optimized mechanism of getting done. 1 thing came find use datatable.select() method condition , check if current row (in rowchanging) exists within returned datarow array. looking little better solution.
thanks buddies.
Comments
Post a Comment