...

View Full Version : ASP Database Output.. as HTML not Text?



design1
03-11-2006, 02:34 AM
Hello,

My level of .asp knowledge isn't the best, but I try!

I have a database, I am simply writing the data from the database to a page, more or less. The problem is, some of the data contains asp tags. This code *should* all work fine. My problem is, its writing the asp code as if it were text. I have the database type set to text (not sure if that has anythign to do with it), but essentially i need it to be wrote as html. Do i need to do something with html encodes? I have used those with forms before, but its been awhile.

A sample of how my code looks like this:
Category: <% if request("category") <> "" then response.write request("category") & " "%>

It should look like:
Category: Blah

Thanks a lot! I really appreciate it!!

degsy
03-13-2006, 03:01 PM
You cannot output ASP code. You can output it as text or HTML.

Use Server.HTMLEncode

degsy
03-13-2006, 03:02 PM
A sample of how my code looks like this:
Category: <% if request("category") <> "" then response.write request("category") & " "%>

It should look like:
Category: Blah
Cannot be done. All you have there is text data, it will not process the ASP code.

CodeMage
03-28-2006, 10:10 PM
So what does one do when you need to have asp within a database record... I have a similar problem I am facing.... which I have tried many work arounds that end up not working for some other reason in the end (EG: iFrames wont print data unless you focus on them, and cant focus on more then 1 iframe)
So what is the solution ?

And yes I do understand the difference between client and server side... but this is a problem my newb butt just can't seem to find a good solution too.

degsy
03-29-2006, 05:20 PM
You could try Executing the string
http://www.4guysfromrolla.com/webtech/030300-1.shtml

mehere
04-07-2006, 08:54 PM
Category: <% if request("category") <> "" then response.write request("category") & " "%>

It should look like:
Category: Blah

Thanks a lot! I really appreciate it!!

I know I'm a little late for this, but whay are you checking to see if it's blank ... just do the following:
Category: <%=request("category")%>

if it's blank ... nothing will print to the page.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum