Hi. I have a page, named "SelectScorecar d", which contains a combo
and some links to outside documents, on the server. These documents
are situated in some sub-folders of the webfolder, named "Previews"
and "BW Previews". On selection of an item in the combo, the HREF of
those links has to change.
In the SelectScorecard .aspx page, I have the code:
<script language="javas cript">
function previewFile(cbo )
{
var index = cbo.selectedInd ex;
var ifr = document.getEle mentById('<%=fr ameDocPreview.C lientID
%>');
var hLink = document.getEle mentById('<%=cm dOpenPreview.Cl ientID
%>');
var hLinkBW = document.getEle mentById('<%=cm dSupporting.Cli entID
%>');
// first item is ' please select...'
if (index 0)
{
ifr.src = 'preview.aspx?f ile=' +
escape(cbo.opti ons[index].text);
hLink.href='<%= request.Applica tionPath %>'+ "/Previews/"+
cbo.options[index].text + ".doc";
hLinkBW.href='< %=request.Appli cationPath %>'+ "/BW Previews/"+
cbo.options[index].text + ".doc"
}
else
{
ifr.src = "#";
hLink.href="#";
hLinkBW.href="# "
}
document.getEle mentById('cmdNe xtPage').focus;
}
</script>
The hyperlinks themselves are defined in that page as:
<asp:HyperLin k
ID="cmdOpenPrev iew"
Font-Size="11px"
Target="_blank"
Text="here"
runat="server">
</asp:HyperLink>
and
<asp:HyperLin k
ID="cmdSupporti ng"
Font-Size="11px"
Target="_blank"
Text="here"
runat="server">
</asp:HyperLink>
The problem is that it works great on my machine.... On the DEV
server, though, upon selection of an item in the combo, HREF goes from
http://uat.mysite.com/Step%201%20-%2...corecard.aspx#
to
http://scorecard%20previews/Operations.doc
thus, obviously, missing the ApplicationPath part, as opposed to the
instance on my machine, which reads
http://localhost:1218/Ordering%20Pro...Operations.doc
which correctly points to the app path in addition to the "Previews"
folder and the selected (in this case, "US Operations") document.
So.... What's wrong with my script, saying
hLink.href='<%= request.Applica tionPath %>'+ "/Previews/"+
cbo.options[index].text + ".doc";
On the server, it picks up only the
"/Previews/"+ cbo.options[index].text + ".doc"
part, whereas on my dev machine it works great.
Thanks a lot for your reading this post.
Alex.