HighTechTalks DotNet Forums  

Dynamically setting file name in a hyperlink

ASP.net Building Controls microsoft.public.dotnet.framework.aspnet.buildingcontrols


Discuss Dynamically setting file name in a hyperlink in the ASP.net Building Controls forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Anne Butera
 
Posts: n/a

Default Dynamically setting file name in a hyperlink - 11-06-2007 , 10:26 PM






I want to set a navigate URL to include the name of a file, that is derived
from a field from the SQL query. I get "Server Tag is not well formed" when
I try to run this:

<asp:HyperLink ID="hyperlink" runat="server" NavigateUrl="\\server\share\"
'<%# Eval("storeNumber")'%> ".doc" >config1</asp:HyperLink>

I want the url to be \\server\share\3.doc

Can someone please tell me what I am doing wrong, or is there a better way
to do this?

Thank you for your time

Ann

Reply With Quote
  #2  
Old   
Mark Fitzpatrick
 
Posts: n/a

Default Re: Dynamically setting file name in a hyperlink - 11-07-2007 , 07:18 AM






Ann,

If you look at the NavigateUrl attribute, you have a bunch of single and
doublequotes. You're going to end up with somethign that looks like this

\\server\share"'3".doc"

Try something like this
<asp:HyperLink ID="hyperlink" runat="server"
NavigateUrl="\\server\share\<%# Eval("storeNumber")%>.doc"
Quote:
config1</asp:HyperLink

--

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - Expression

"Anne Butera" <AnneButera (AT) discussions (DOT) microsoft.com> wrote

Quote:
I want to set a navigate URL to include the name of a file, that is derived
from a field from the SQL query. I get "Server Tag is not well formed"
when
I try to run this:

asp:HyperLink ID="hyperlink" runat="server" NavigateUrl="\\server\share\"
'<%# Eval("storeNumber")'%> ".doc" >config1</asp:HyperLink

I want the url to be \\server\share\3.doc

Can someone please tell me what I am doing wrong, or is there a better way
to do this?

Thank you for your time

Ann



Reply With Quote
  #3  
Old   
Anne Butera
 
Posts: n/a

Default Re: Dynamically setting file name in a hyperlink - 11-07-2007 , 10:58 AM



Thank you for your reply.

So I tried your suggetions, and now I'm able to run the form and click the
hyperlink, but the url looks like this:

\\server\share\<%# Eval("storeNumber") %>.doc

Here's the code I used:

<asp:HyperLink ID="HLconfig1" runat="server" NavigateUrl='\\server\share\<%#
Eval("storeNumber") %>.doc'>config1</asp:HyperLink>


Do you have any other suggestions? Thank you for your time.


"Mark Fitzpatrick" wrote:

Quote:
Ann,

If you look at the NavigateUrl attribute, you have a bunch of single and
doublequotes. You're going to end up with somethign that looks like this

\\server\share"'3".doc"

Try something like this
asp:HyperLink ID="hyperlink" runat="server"
NavigateUrl="\\server\share\<%# Eval("storeNumber")%>.doc"
config1</asp:HyperLink


--

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - Expression

"Anne Butera" <AnneButera (AT) discussions (DOT) microsoft.com> wrote in message
newsFAA741C-2710-4DE2-B4D9-1AA2547C6B37 (AT) microsoft (DOT) com...
I want to set a navigate URL to include the name of a file, that is derived
from a field from the SQL query. I get "Server Tag is not well formed"
when
I try to run this:

asp:HyperLink ID="hyperlink" runat="server" NavigateUrl="\\server\share\"
'<%# Eval("storeNumber")'%> ".doc" >config1</asp:HyperLink

I want the url to be \\server\share\3.doc

Can someone please tell me what I am doing wrong, or is there a better way
to do this?

Thank you for your time

Ann




Reply With Quote
  #4  
Old   
Riki
 
Posts: n/a

Default Re: Dynamically setting file name in a hyperlink - 11-11-2007 , 08:54 AM



Try:
NavigateUrl='<%# Eval("storeNumber","\\server\share\{0}") %>'

--
Riki

Anne Butera wrote:
Quote:
Thank you for your reply.

So I tried your suggetions, and now I'm able to run the form and
click the hyperlink, but the url looks like this:

\\server\share\<%# Eval("storeNumber") %>.doc

Here's the code I used:

asp:HyperLink ID="HLconfig1" runat="server"
NavigateUrl='\\server\share\<%# Eval("storeNumber")
%>.doc'>config1</asp:HyperLink


Do you have any other suggestions? Thank you for your time.


"Mark Fitzpatrick" wrote:

Ann,

If you look at the NavigateUrl attribute, you have a bunch of single
and doublequotes. You're going to end up with somethign that looks
like this

\\server\share"'3".doc"

Try something like this
asp:HyperLink ID="hyperlink" runat="server"
NavigateUrl="\\server\share\<%# Eval("storeNumber")%>.doc"
config1</asp:HyperLink


--

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - Expression

"Anne Butera" <AnneButera (AT) discussions (DOT) microsoft.com> wrote in message
newsFAA741C-2710-4DE2-B4D9-1AA2547C6B37 (AT) microsoft (DOT) com...
I want to set a navigate URL to include the name of a file, that is
derived from a field from the SQL query. I get "Server Tag is not
well formed" when
I try to run this:

asp:HyperLink ID="hyperlink" runat="server"
NavigateUrl="\\server\share\" '<%# Eval("storeNumber")'%> ".doc"
config1</asp:HyperLink

I want the url to be \\server\share\3.doc

Can someone please tell me what I am doing wrong, or is there a
better way to do this?

Thank you for your time

Ann



Reply With Quote
  #5  
Old   
Anne Butera
 
Posts: n/a

Default Re: Dynamically setting file name in a hyperlink - 11-13-2007 , 01:59 PM



Yes, that worked! Thanks

"Riki" wrote:

Quote:
Try:
NavigateUrl='<%# Eval("storeNumber","\\server\share\{0}") %>'

--
Riki

Anne Butera wrote:
Thank you for your reply.

So I tried your suggetions, and now I'm able to run the form and
click the hyperlink, but the url looks like this:

\\server\share\<%# Eval("storeNumber") %>.doc

Here's the code I used:

asp:HyperLink ID="HLconfig1" runat="server"
NavigateUrl='\\server\share\<%# Eval("storeNumber")
%>.doc'>config1</asp:HyperLink


Do you have any other suggestions? Thank you for your time.


"Mark Fitzpatrick" wrote:

Ann,

If you look at the NavigateUrl attribute, you have a bunch of single
and doublequotes. You're going to end up with somethign that looks
like this

\\server\share"'3".doc"

Try something like this
asp:HyperLink ID="hyperlink" runat="server"
NavigateUrl="\\server\share\<%# Eval("storeNumber")%>.doc"
config1</asp:HyperLink


--

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - Expression

"Anne Butera" <AnneButera (AT) discussions (DOT) microsoft.com> wrote in message
newsFAA741C-2710-4DE2-B4D9-1AA2547C6B37 (AT) microsoft (DOT) com...
I want to set a navigate URL to include the name of a file, that is
derived from a field from the SQL query. I get "Server Tag is not
well formed" when
I try to run this:

asp:HyperLink ID="hyperlink" runat="server"
NavigateUrl="\\server\share\" '<%# Eval("storeNumber")'%> ".doc"
config1</asp:HyperLink

I want the url to be \\server\share\3.doc

Can someone please tell me what I am doing wrong, or is there a
better way to do this?

Thank you for your time

Ann




Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.