Click to See Complete Forum and Search --> : Reading then displaying small text.txt file string


SamJ
08-01-2004, 05:38 PM
I am finding my way through HTML and ASP (some .NET too). I want to read a server side small text string then display the string in a form on my page. I have been eperimenting with various FSO variations and made this one work. But need help putting into lable or textbox for display amongst html.

<%
dim fsoObject
dim tsObject
dim strReturned
const constForReading = 1
const constTristateFalse = 0
Set fsoObject = Server.CreateObject("Scripting.FileSystemObject")
Set tsObject = fsoObject.OpenTextFile("d:\scollettedesign.com\_websites\richsoil\richOilX.txt", constForReading, constTristateFalse)
Do While Not tsObject.AtEndOfLine
strReturned = strReturned & tsObject.Read(1)
Loop


response.write " Hello with price test "
response.write time
response.write strReturned

%>

buntine
08-02-2004, 05:04 AM
To display the contents of an ASP variable inside a textbox or similar HTML form control, you can use the script delimiters provided by ASP to insert server-generated data amongst static HTML elements.

<form>
<input type="text" name="txtName" value="<%= strReturned %>" />
</form>

When output to the users Web Browser, the preceding snippet will print the value of the variable 'strReturned' inside the textbox control.

Regards,
Andrew Buntine.

SamJ
08-02-2004, 05:16 AM
Tks Andrew.... I think that did the trick! I need to sit with the code more often and keep this stuff fresh. Tks again.

Sam

buntine
08-02-2004, 07:14 AM
Your welcome. ;)