Really getting frustrated here. I've got the MapPath working and spewing
out the right path...I am able to print it out on the page with <% =
theFileMapped %>. It's just not catching on my conditional statement in the
code behind and making my panel visible. I can turn the panel on and off
manually in the <asp:label visible=> attribute, but it just doesn't work in
my code behind.
In my page:
--------------------
<ASP
ANEL ID="pnlIntro" VISIBLE="False" RUNAT="server"><SPAN
STYLE="FONT-SIZE: 10px">. </SPAN>
<A CLASS="secondNav"
HREF="/livelihoods/<% = countryCode %>/intro.pdf"
TARGET="_blank">Zoning/Profiling Intro</A><BR>
</ASP
ANEL>
In my code-behind
----------------------------
Public theFile As String
Public theFileMapped As String
Protected WithEvents pnlIntro As System.Web.UI.WebControls.Panel
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
theFile = "~/livelihoods/files/" & countryCode & "/intro.pdf"
theFileMapped = Server.MapPath(theFile)
If System.IO.File.Exists(theFileMapped) Then
pnlIntro.Visible = True
End If
End Sub
_____
DC G
Matt Berther said:
Hello DC,
theFile = Server.MapPath("~/livelihoods/files/" & countryCode & "/intro.pdf")
Notice the ~...
The ~ is an alias for the current virtual root. Otherwise you'd be
looking
in the web applications root folder (ie: c:\inetpub\wwwroot\livelihoods)