John Parker
asked on
ASP.NET Server Tag Not Parsing in URL Field
Experts,
I'm banging my head against a wall here, and I'm sure this is a simple syntax issue. I am working with a ListView control, and I'm trying to construct a hyperlink that parses a datafield into the query string of a URL (the page that is being called in the URL serves the image data from the provided filename back as a filestream because the image being called resides in a location outside the application folder.)
The server doesn't choke on the code, but the URL that gets associated with the hyperlink isn't evaluating the server tag (see below.)
I should point out that this worked fine before I added the ASPX page to the URL (code below worked...)
Why does adding "~/ServeFFAttachment.aspx? FileName=" before the Server Tag mess it up??
HELP!! :-)
Thanks,
John
I'm banging my head against a wall here, and I'm sure this is a simple syntax issue. I am working with a ListView control, and I'm trying to construct a hyperlink that parses a datafield into the query string of a URL (the page that is being called in the URL serves the image data from the provided filename back as a filestream because the image being called resides in a location outside the application folder.)
<asp:HyperLink runat="server"
NavigateUrl='~/ServeFFAttachment.aspx?FileName=<%# Eval("ATTACHMENT_PATH") %>'
Target="_blank">
<%# Eval("ATTACHMENT_DESC") %>
</asp:HyperLink>
The server doesn't choke on the code, but the URL that gets associated with the hyperlink isn't evaluating the server tag (see below.)
http://serverfqdn:55555/ServeFFAttachment.aspx?FileName=<%# Eval("ATTACHMENT_PATH") %>
I should point out that this worked fine before I added the ASPX page to the URL (code below worked...)
<asp:HyperLink runat='server'
NavigateUrl='<%# Eval("ATTACHMENT_PATH") %>'
Target='_blank'>
<%# Eval("ATTACHMENT_DESC") %>
</asp:HyperLink>
Why does adding "~/ServeFFAttachment.aspx?
HELP!! :-)
Thanks,
John
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That was it! Thank you very much for the quick response! I did have to make one minor change to the use of the URLEncoded function... I had to add the ToString method to the Eval function for it to work. Otherwise the compiler didn't like it.
Open in new window
Thanks again!
John