Telerik RadFilter - How to remove and expression from Radfilter programatically? -
i have requirement need remove expression radfilter programatically. radfilter tied radgrid , user has option remove column grid.
when column removed, need loop through expression in radfilter , remove ones defined on column. can please me this?
i figured out how make work. telerik controls black hole , there not whole lot of documentation out there if want implement more complicated functionality , not stick demo scenarios have. hope helps somebody.
public void yourmethod() { //rfreport radfilter control defined somewhere on aspx page //fieldname gridcolumns's datafield property expression want //remove radfilter removefilterexpressions(rfreport.rootgroup, string fieldname); } private void removefilterexpressions(radfiltergroupexpression filtergroupexpression, string fieldname) { (int = filtergroupexpression.expressions.count - 1; >= 0; i--) { var exp = filtergroupexpression.expressions[i]; if (exp.filterfunction == radfilterfunction.group) { removefilterexpressions(exp radfiltergroupexpression, fieldname); //remove filtergroupexpression if has no expressions if (((radfiltergroupexpression)exp).expressions.count == 0) { filtergroupexpression.expressions.remove(exp); } } else { if (((radfilternongroupexpression)exp).fieldname == fieldname) { //remove expression if fieldname == fieldname filtergroupexpression.expressions.remove(exp); } } } }
Comments
Post a Comment