Gripfill is probably best, the solvented type in the green tube. Use plenty, but not so much that it squeezes from the edges when you push the upstand to the wall. If you can, wedge the upstand in place whilst it dries, in the worst cases you can wedge it with a piece of timber from the...