I suggest using a cable tie through the D rings and hooking over the bit of the rack that forms a 'hook'.
Make the cable tie into a loop, adjust until it only just allows you to lift pannier on/off.
Carry replacements - if you make cable tie too tight, cut it and replace it.
Cable ties used like this are better than cord or elastic with hooks, IMO.