I have an aspx page with some c# code blocks in it and I am trying to use a variable from the first block in the second block. I've tried lots of different things to make the variable public and available but haven't managed it. Can someone point out/give me a clue as to where I am going wrong please?
This is some of my code:
<%@ Page Language="C#"%>
<%
string myVar;
myVar = ”Dan”;
%>
<script>
function buildHyperlinks(){
try{
$(<a href ='http://myServer/sites/page.aspx?params=<% Response.Write(myVar);%>'>"`
}catch(err){
setTimeout(buildHyperlinks(), 5000);
}
}
</script>
Thanks, Dan