What's wrong with this simple script ? I've been really fighting this one !

A

Alex

I have a combo named cboType. Depending on its index, I need to build
a string to assign to the NavigateUrl of a hyperlink (the path to a
doc in the 'previews' subfolder).

I get a "The server tag is not well formed' error.....

NavigateUrl=
'<%#"javascript:
var index =
document.getElementById('cboType.ClientID').selectedIndex;
return '~/Previews/' + cboType.options[index].text + '.doc';
"%>'

I have tried this in many ways..... the same problem.... :-(((((

Thanks a lot !
Alex
 
A

Alex

I have a combo named cboType. Depending on its index, I need to build
a string to assign to the NavigateUrl of a hyperlink (the path to a
doc in the 'previews' subfolder).
I get a "The server tag is not well formed' error.....
NavigateUrl=
'<%#"javascript:
var index =
document.getElementById('cboType.ClientID').selectedIndex;
return '~/Previews/' + cboType.options[index].text + '.doc';
"%>'

The error message indicates that the server is trying to evaluate the JS
inside the <%#...%>, but that isn't what you want. You want the JS to
show up on the client's computer in the web page, to evaluate after the
user has selected one of cboType's options.

Thanks for answering, Jim. I understand your point.... but how do I go
about doing that ? I'm looking at this code, and to me(because of my
very limited knowledge) it looks alright....

Alex.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,262
Messages
2,571,056
Members
48,769
Latest member
Clifft

Latest Threads

Top