tags:

views:

62

answers:

1

Ok so I have this string thats going to be an attribute of script tag:

path = "<%= this.ResolveUrl('~/" + path + "') %>";

only problem is when I dynamically generate the tag it turns into:

<script src="&lt;%= this.ResolveUrl('~/Scripts/jquery.js') %>" type="text/javascript"></script>

I don't want the &lt; to be there I want an < to be there...

How can I fix this to generate the < instead of &lt;

I have already tried escaping it by using @"&lt;" and that doesn't work.

Any suggestions?

+3  A: 

Use the following line:

path = this.ResolveUrl("~/Scripts/jquery.js");

Tip: Since you are using jQuery you should have a look at the Google AJAX Libraries API. Its basically jQuery and a lot of other AJAX APIs hosted on Google's CDN (so you don't have to). Include it on your page by doing something like:

ScriptManager.RegisterClientScriptInclude(
        this,
        typeof(Page),
        "jQuery",
        "http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js");

or simply

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
JohannesH