Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 19th, 2005, 07:27 AM
Mark Sippitt
Guest
 
Posts: n/a
Default Spaces

I have a problem with the following code :

Response.write rstContacts(1).Value

The above line prints "Andark Marine"

However the following only passes "Andark" and stops at
the space. How do I get over this ? Its the same with all
records.

Response.Write("<td align=center><a
ref=companycontacts.asp?Company=" & rstContacts(1).Value
& " target=_new><img src=images\contact.ico width=25
height=25 border=0></a></td>")

Thanks for our help
Mark

  #2  
Old July 19th, 2005, 07:27 AM
Shailesh Humbad
Guest
 
Posts: n/a
Default Re: Spaces

Two things:
1. Use Chr(34) to put quotes around the href.
2. Use Server.UrlEncode to encode the link.

like this:

Response.Write("<td align=center><a
href="&Chr(34)&"companycontacts.asp?Company=" &
Server.UrlEncode(rstContacts(1).Value)&Chr(34)&
& " target=_new><img src=images\contact.ico width=25
height=25 border=0></a></td>")

If rst may contain nulls, then put urlencode into a function like this:

Function PrintEncoded(strValue)
If IsNull(strValue) Then
PrintEncoded = ""
Else
PrintEncoded = Server.UrlEncode(strValue)
End If
End Function

UrlEncode will give an error if it is given a null value.

Shailesh.

Mark Sippitt wrote:
[color=blue]
> I have a problem with the following code :
>
> Response.write rstContacts(1).Value
>
> The above line prints "Andark Marine"
>
> However the following only passes "Andark" and stops at
> the space. How do I get over this ? Its the same with all
> records.
>
> Response.Write("<td align=center><a
> ref=companycontacts.asp?Company=" & rstContacts(1).Value
> & " target=_new><img src=images\contact.ico width=25
> height=25 border=0></a></td>")
>
> Thanks for our help
> Mark
>[/color]

  #3  
Old July 19th, 2005, 07:27 AM
Mats
Guest
 
Posts: n/a
Default Re: Spaces

Generally yo can't have spaces in a Querystring, parsing stops at the
space.(I've seen somewhere that Apache might tolerate it)
Mats
"Mark Sippitt" <msippitt@hotmail.com> wrote in message news:<081d01c35cb1$9f40b290$a501280a@phx.gbl>...[color=blue]
> I have a problem with the following code :
>
> Response.write rstContacts(1).Value
>
> The above line prints "Andark Marine"
>
> However the following only passes "Andark" and stops at
> the space. How do I get over this ? Its the same with all
> records.
>
> Response.Write("<td align=center><a
> ref=companycontacts.asp?Company=" & rstContacts(1).Value
> & " target=_new><img src=images\contact.ico width=25
> height=25 border=0></a></td>")
>
> Thanks for our help
> Mark[/color]
  #4  
Old July 19th, 2005, 07:27 AM
vivek
Guest
 
Posts: n/a
Default Re: Spaces

why use response.write to display a link which has zillion double quotes, to
put it in a more simple way do this:

end you asp tag
%>

<td align="center"><a href="contacts.asp?company=<%=rstContacts(1).Value %>"
target=_new><img src=images\contact.ico width=25[color=blue]
> height=25 border=0></a></td>[/color]

<%
then restart your asp code here
%>

Vivek


"Mark Sippitt" <msippitt@hotmail.com> wrote in message
news:081d01c35cb1$9f40b290$a501280a@phx.gbl...[color=blue]
> I have a problem with the following code :
>
> Response.write rstContacts(1).Value
>
> The above line prints "Andark Marine"
>
> However the following only passes "Andark" and stops at
> the space. How do I get over this ? Its the same with all
> records.
>
> Response.Write("<td align=center><a
> ref=companycontacts.asp?Company=" & rstContacts(1).Value
> & " target=_new><img src=images\contact.ico width=25
> height=25 border=0></a></td>")
>
> Thanks for our help
> Mark
>[/color]


  #5  
Old July 19th, 2005, 07:27 AM
Tom B
Guest
 
Posts: n/a
Default Re: Spaces

Response.Write "<td align=""center"">" & _
"<a href=""companycontacts.asp?Company=" & _
rstContacts(1).Value & _
""" target=_new>" & _
"<img src=""images\contact.ico"" width=""25""
height=""25"" border=""0""></a></td>"

All I've done is add double quotes around the properties of your tags. The
result will be
<td align="center"><a href="companycontacts.asp?Company=Andark Marine"><img
src="images\contact.ico" width="25" height="25" border="0"></a></td>

I've never tried but I'm pretty sure an ico file isn't going to show up on
IE



"Mark Sippitt" <msippitt@hotmail.com> wrote in message
news:081d01c35cb1$9f40b290$a501280a@phx.gbl...[color=blue]
> I have a problem with the following code :
>
> Response.write rstContacts(1).Value
>
> The above line prints "Andark Marine"
>
> However the following only passes "Andark" and stops at
> the space. How do I get over this ? Its the same with all
> records.
>
> Response.Write("<td align=center><a
> ref=companycontacts.asp?Company=" & rstContacts(1).Value
> & " target=_new><img src=images\contact.ico width=25
> height=25 border=0></a></td>")
>
> Thanks for our help
> Mark
>[/color]


  #6  
Old July 19th, 2005, 07:27 AM
Mark Sippitt
Guest
 
Posts: n/a
Default Re: Spaces

Vivek,

I think you will find that method also does not work unfortunately, but
agree with you about the clarity, without the complication of double
quotes...

Mark Sippitt MIAP
Senior Developer

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #7  
Old July 19th, 2005, 07:28 AM
vivek
Guest
 
Posts: n/a
Default Re: Spaces

It didnt work??

Vivek

"Mark Sippitt" <msippitt@hotmail.com> wrote in message
news:eQ1WiROXDHA.3268@tk2msftngp13.phx.gbl...[color=blue]
> Vivek,
>
> I think you will find that method also does not work unfortunately, but
> agree with you about the clarity, without the complication of double
> quotes...
>
> Mark Sippitt MIAP
> Senior Developer
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it![/color]


  #8  
Old July 19th, 2005, 07:28 AM
Tom B
Guest
 
Posts: n/a
Default Re: Spaces

Why wouldn't it work. I do that sort of thing all the time.
"Mark Sippitt" <msippitt@hotmail.com> wrote in message
news:eQ1WiROXDHA.3268@tk2msftngp13.phx.gbl...[color=blue]
> Vivek,
>
> I think you will find that method also does not work unfortunately, but
> agree with you about the clarity, without the complication of double
> quotes...
>
> Mark Sippitt MIAP
> Senior Developer
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it![/color]


  #9  
Old July 19th, 2005, 07:28 AM
Mark Schupp
Guest
 
Posts: n/a
Default Re: Spaces

The parameter value should also be urlencoded

Response.Write "<td align=""center"">" & _
"<a href=""companycontacts.asp?Company=" & _
Server.URLEncode(rstContacts(1).Value) & _
""" target=_new>" & _
"<img src=""images\contact.ico"" width=""25""
height=""25"" border=""0""></a></td>"


--
Mark Schupp
--
Head of Development
Integrity eLearning
Online Learning Solutions Provider
mschupp@ielearning.com
http://www.ielearning.com
714.637.9480 x17


"Tom B" <shuckle@hotmail.com> wrote in message
news:%23jKJBMOXDHA.656@tk2msftngp13.phx.gbl...[color=blue]
> Response.Write "<td align=""center"">" & _
> "<a href=""companycontacts.asp?Company=" & _
> rstContacts(1).Value & _
> """ target=_new>" & _
> "<img src=""images\contact.ico"" width=""25""
> height=""25"" border=""0""></a></td>"
>
> All I've done is add double quotes around the properties of your tags.[/color]
The[color=blue]
> result will be
> <td align="center"><a href="companycontacts.asp?Company=Andark[/color]
Marine"><img[color=blue]
> src="images\contact.ico" width="25" height="25" border="0"></a></td>
>
> I've never tried but I'm pretty sure an ico file isn't going to show up on
> IE
>
>
>
> "Mark Sippitt" <msippitt@hotmail.com> wrote in message
> news:081d01c35cb1$9f40b290$a501280a@phx.gbl...[color=green]
> > I have a problem with the following code :
> >
> > Response.write rstContacts(1).Value
> >
> > The above line prints "Andark Marine"
> >
> > However the following only passes "Andark" and stops at
> > the space. How do I get over this ? Its the same with all
> > records.
> >
> > Response.Write("<td align=center><a
> > ref=companycontacts.asp?Company=" & rstContacts(1).Value
> > & " target=_new><img src=images\contact.ico width=25
> > height=25 border=0></a></td>")
> >
> > Thanks for our help
> > Mark
> >[/color]
>
>[/color]


 

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles