Link to home
Start Free TrialLog in
Avatar of webressurs
webressursFlag for Norway

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) {}"
ASKER CERTIFIED SOLUTION
Avatar of Abhi231
Abhi231

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial