jamesplank
Posts: 8
|
| Posted: 07/12/2006, 7:41 PM |
|
This should be straight forward but its kicking my butt
I have a database field (named Url) that contains a text that is a web page. each record holds a diffrernet redirect web page.
I though that this would be easy.
I have a link that correctly shows this field and I wish (no surprises here) to go to this website when I click the link. I have set the HRef properties such that the link address is "Address from database".
I have the paramter set to a GUID value in the grid col I want...
And it works to a point.
It grabs the web page address , but it pads out the blank spaces in the field with %20 ie %20 %20 %20 %20 %20
so I get this ...
http://localhost/VirtualPA07/proofing.asp?PK_Mastertext...95D130BC7FC6%7D
manually remove the %20 and it works ie. http://localhost/VirtualPA07/proofing.asp%20%20%20%20%2...95D130BC7FC6%7D
How can I stop this padding? or strip out the blank spaces?
Help
Regards
James Plank
_________________
James Nicholson-Plank
Icon Communications Ltd
New Zealand
ph 0064-3-3659899 |
 |
 |
peterr
Posts: 5971
|
| Posted: 07/12/2006, 8:28 PM |
|
Quote :it pads out the blank spaces in the field with %20
Are you saying that you have blank spaces in that database field? Why not remove them from the DB and have clean links there?
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
James Nicholson-Plank
|
| Posted: 07/12/2006, 9:46 PM |
|
Sorry,
I didnt explain it clearly.
I dont actually put blank spaces in.
the field is 30 or so characters long
and the web page only takes up a few of those.
So it fills the rest of the available space from the DB field
with these characters. (%20)
The DB is sqlserver 2005 and its a "char" type field
|
|
|
 |
peterr
Posts: 5971
|
| Posted: 07/12/2006, 11:41 PM |
|
Got it. The (%20) characters are not a problem because they are a normal representation of spaces and we probably have no control of this. Basically "%20" is the encoded space character and it is encoded automatically by the Web browser, I guess for a reason.
Now the only issue is where the spaces are coming from. I think one solution may be to convert your database field from char to varchar. Another method may be to modify the link value programmatically in the "Before Show" event. Let me check what code might work and I will get back to you.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
peterr
Posts: 5971
|
| Posted: 07/13/2006, 12:00 AM |
|
Here we go, based on one of the solutions from http://www.aspfaqs.com/aspfaqs/ShowFAQ.asp?FAQID=149 :
Do While InStr(1, FormName.LinkName.Link, " ")
FormName.LinkName.Link = Replace(FormName.LinkName.Link, " ", "")
Loop
(replace FormName.LinkName with your actual form name and link name)
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
James Nicholson-Plank
|
| Posted: 07/13/2006, 5:38 PM |
|
Great thanks
it worked.
Varchar didnt make a difference, possibly because I converted it from a char and it heild the spaces, but the code worked a treat!
Muchly appreciated.
Cheers
James
|
|
|
 |
DonB
|
| Posted: 07/14/2006, 7:04 AM |
|
It would definitely be because you converted from CHAR to VARCHAR. You
could fix it up with:
UPDATE mytable SET mycolumn = TRIM(mycoluum);
--
DonB
http://www.gotodon.com/ccbth
<JamesNicholson-Plank@forum.codecharge (James Nicholson-Plank)> wrote in
messagenews:644b6e79008095@news.codecharge.com...
> Great thanks
> it worked.
> Varchar didnt make a difference, possibly because I converted it from a
char
> and it heild the spaces, but the code worked a treat!
>
> Muchly appreciated.
> Cheers
> James
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
 |
James Nicholson-Plank
|
| Posted: 07/15/2006, 1:46 PM |
|
Appreciate the tip. Thanks Ill do that
Cheers James
|
|
|
 |