I want to link to a section of a dynamic page using the # anchor, something like this:
LINK
You've only presented half of your code so I can only give a sample of the proper way to do it:
Go To Top Of Page