could be this is an HTML problem, but I'll take the help anywhere I can find it...

<%
@ Page Language = "VB" aspcompat=true Explicit="True" 
Dim src As String = " bet "
%>

<html>
<head ></head>
<body >

<form name=loc action=testsac.aspx method=get>
<table class=s0 width=100% cellpadding=1 cellspacing=1 align=center border=1>
  <tr class=s0 align=center>
    <td>
    Search For:
    <input class=s0 size=50 name=src  value=<%=src%>>
    <input class=s0 type=submit value=Search />
    <td></td>
  </tr>
</table>
</form>

</body>
</html>

on the screen, "bet" is the search string, but I want " bet "
any ideas?

Recommended Answers

All 4 Replies

Try this:

Dim src As String =  Chr(32) & "bet" & Chr(32)

Not sure if it will solve your problem, but it appears as though it is being trimmed (trim())...

Try this:

Dim src As String =  Chr(32) & "bet" & Chr(32)

Not sure if it will solve your problem, but it appears as though it is being trimmed (trim())...

No, really it's a variable, which may or may not contain the leading and trailing spaces. When you assign as the value of a textbox, it is automatically trimmed. I'm looking for some kind of way to override that and leave the blanks in there.

Okay I see your issue now...

<html>
<head ></head>
<body >

<form name=loc action=testsac.aspx method=get>
<table class=s0 width=100% cellpadding=1 cellspacing=1 align=center border=1>
  <tr class=s0 align=center>
    <td>
    Search For:
    <input class=s0 size=50 name=src  value="&nbsp;<%=src %>&nbsp;">
    <input class=s0 type=submit value=Search />
    <td></td>
  </tr>
</table>
</form>

</body>
</html>

It worked for me in Firefox 3.5

commented: The quotation marks are needed... +1

I solved this problem myself.
The answer is:

<input size=50 name=src  value="<%=src%>">

instead of

<input size=50 name=src  value=<%=src%>>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.