For drag and drop, you have a built in behavior.
About gris, just set the position every tick or at a trigger to round(yourposition*32)/32
32 can be replaced by your grid size
(please note that i wrote that from my memory, the code may not work, tell me if this is the case, i will check later )