webressurs
asked on
Access Server variable from ASP.NET in javascript
I have a javascript that needs to get the "rootID" value from my asp.net code behind file. The problem is that the link dont write out the id, but it writes out "<%=rootId%>".
It means, this is the link I get:
add.aspx?id=<%=rootId%>
The link should be like this:
add.aspx?id=123
Here is my code:
OnClientClick="try {window.location('add.aspx ?id=' + targetEl.id.replace('id',' ').replace ('root_0', '<%=rootId %>'));} catch (e) {}"
It means, this is the link I get:
add.aspx?id=<%=rootId%>
The link should be like this:
add.aspx?id=123
Here is my code:
OnClientClick="try {window.location('add.aspx
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.