In this particular case, have you tried using the <% *variable name from server side* %> as your dynamic variable in the actual javascript part? Thus in the javascript part place this in and it could work...
<br />
<a href='#' runat='server' onclick='javascript:ShowDiv(this,1,"+ <%= DynamicVariable %> +");' id='" + <%= y %> + "' style=cursor: hand><br />
This is just a guess, but also remember that firing a javascript function from the server side requires extra coding indeed, there are a few ways using AJAX and also there is the dirty way of making button with the function then make visibility hidden and simply on the server side call the button to be clicked and thats done, not good practice to do though.
good luck mate sorry I couldn't be of any more help...