I probably wouldn't do this. It's not really good for any structural situation. When it's used in decking, you need 12" on center instead of 16" because it will sag between the joists so easily.
Trex is basically plastic pieces smashed together. Plastic has a "creep" situation were over time, under stress, it can change shape with virtually no force. If you put it on its side, I'd be willing to bet that it will bow out sideways and make a "C" shape within a very short time, especially if there is any weight on top of it.
My father in-law used it for the railing for his deck because he felt it would be easier to maintain and would prevent splinters. In the end, it sagged so bad that it looked like it was melting off of the railing, plus it cracked pretty bad too.
You can try it, but I would make sure you can get to it to inspect and replace if needed.
Good luck!