This would work using FeatureLayers, using Definition Expressions. It would be a different workflow with ArcGISDynamicMapServiceLayers, since the graphics layer where you would show the results is separate.
I have many lines. Around 2000 flight lines (Tie lines and ordinary lines, Tie lines are perpendicular to ordinary), but only some are coming into my application and some are incorrectly displaying as Tie_lines when they should be lines.