|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
How to handle Spaces in Variable for creating href..
<i><b>Originally posted by : Sanjay Goel (sgoel@indcon.com)</b></i><br />Hi<br /><br />I am creating href in one coloum (output of searches) which is in tabular form..<br /><br />eg. <a href="<%=Variable%>">Where Actual value for this variable is "Sliver Stream"</a><br /><br />You know, spaces should be converted to %...<br /><br />Can anyone tell me how to convert the variable in proper format for href...<br /><br />Thanks in Advance..<br /><br />Sanjay<br />sgoel@indcon.com<br />
|
|
#2
|
|||
|
|||
|
<i><b>Originally posted by : Chris Snider (csnider@worldnet.att.net)</b></i><br />Sanjay,<br />In your output statement use Server.URLEncode(stuff).<br />Your output would be <a href="<%= Server.URLEncode(Variable)%>"><%= Variable%></a><br />This will use the value of the variable as the href anchor point as well as display the contents in "straight" form.<br /><br />If you need further explanation or comments, please email me.<br /><br />Chris Snider<br /><br /><br />------------<br />Sanjay Goel at 3/28/2000 9:21:33 PM<br /><br />Hi<br /><br />I am creating href in one coloum (output of searches) which is in tabular form..<br /><br />eg. <a href="<%=Variable%>">Where Actual value for this variable is "Sliver Stream"</a><br /><br />You know, spaces should be converted to %...<br /><br />Can anyone tell me how to convert the variable in proper format for href...<br /><br />Thanks in Advance..<br /><br />Sanjay<br />sgoel@indcon.com<br />
|
|
#3
|
|||
|
|||
|
<i><b>Originally posted by : </b></i><br />Thanks Chris..<br /><br />It worked..<br /><br />There is also another way of doing it..<br /><a href="<%= Server.Replace(Variable)," ","%20"%>"><%= Variable%></a><br /><br />It will replaces all spaces with the appropriate characters, which will work with IE and Netscape...<br /><br />Regards, Sanjay<br /><br /><br />------------<br />Chris Snider at 3/30/2000 12:30:33 AM<br /><br />Sanjay,<br />In your output statement use Server.URLEncode(stuff).<br />Your output would be <a href="<%= Server.URLEncode(Variable)%>"><%= Variable%></a><br />This will use the value of the variable as the href anchor point as well as display the contents in "straight" form.<br /><br />If you need further explanation or comments, please email me.<br /><br />Chris Snider<br /><br /><br />------------<br />Sanjay Goel at 3/28/2000 9:21:33 PM<br /><br />Hi<br /><br />I am creating href in one coloum (output of searches) which is in tabular form..<br /><br />eg. <a href="<%=Variable%>">Where Actual value for this variable is "Sliver Stream"</a><br /><br />You know, spaces should be converted to %...<br /><br />Can anyone tell me how to convert the variable in proper format for href...<br /><br />Thanks in Advance..<br /><br />Sanjay<br />sgoel@indcon.com<br />
|
|
#4
|
|||
|
|||
|
<i><b>Originally posted by : Chris Snider (csnider@worldnet.att.net)</b></i><br />Sanjay,<br /><br />Yes the Replace function will work, but you have to use it for all "illegal" characters. The Server.URLEncode function prepares the entire response to work in a URL and you don't have to remember or code for all the possibilities.<br /><br />Regards<br /><br />Chris Snider<br />------------<br /> at 3/30/2000 7:48:55 AM<br /><br />Thanks Chris..<br /><br />It worked..<br /><br />There is also another way of doing it..<br /><a href="<%= Server.Replace(Variable)," ","%20"%>"><%= Variable%></a><br /><br />It will replaces all spaces with the appropriate characters, which will work with IE and Netscape...<br /><br />Regards, Sanjay<br /><br /><br />------------<br />Chris Snider at 3/30/2000 12:30:33 AM<br /><br />Sanjay,<br />In your output statement use Server.URLEncode(stuff).<br />Your output would be <a href="<%= Server.URLEncode(Variable)%>"><%= Variable%></a><br />This will use the value of the variable as the href anchor point as well as display the contents in "straight" form.<br /><br />If you need further explanation or comments, please email me.<br /><br />Chris Snider<br /><br /><br />------------<br />Sanjay Goel at 3/28/2000 9:21:33 PM<br /><br />Hi<br /><br />I am creating href in one coloum (output of searches) which is in tabular form..<br /><br />eg. <a href="<%=Variable%>">Where Actual value for this variable is "Sliver Stream"</a><br /><br />You know, spaces should be converted to %...<br /><br />Can anyone tell me how to convert the variable in proper format for href...<br /><br />Thanks in Advance..<br /><br />Sanjay<br />sgoel@indcon.com<br />
|
![]() |
| Viewing: ASP Free Forums > Programming > ASP Development > How to handle Spaces in Variable for creating href.. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|