cruisin
Posts: 31
|
| Posted: 07/22/2005, 6:47 AM |
|
I'm trying to convert a regular ASP program to Codecharge. Everything looks fine and I get no errors, but I also don't get any output. There is a line to
Response.Write Variable name
but I don't seem to have the right syntax. I've created a custom lable, and I've tried changing the buffer settings in the common.asp, but I'm still not getting any output.
Any examples or suggestions would be appreciated.
Rob
|
 |
 |
Benjamin Krajmalnik
|
| Posted: 07/22/2005, 11:19 AM |
|
You need to understand the CodeCharge model.
If you direct response.write from code you are generating output out of
sequence. Codecharge works by parsing a template, building an output stream
based on the actions, and then sending it to the screen.
The code should be changed to assign the CodeCharge control the value, and
then it should work.
|
|
|
 |
peterr
Posts: 5971
|
| Posted: 07/22/2005, 11:41 AM |
|
The Response.Write command can be used mainly for debugging purposes in CCS, and often would need to be used in combination with Response.Buffer = True or Response.Flush or Response.End.
Benjamin is right that you cannot use Response.Write in an application that uses HTML Templates. A sample code that you would need to use is:
Dim MyHTMLSnippet
MyHTMLSnippet = "<h1>Hello World</h1><hr>"
Label1.Value = MyHTMLSnippet
This code would be placed in the Before Show event of the page or the label. Of course you can also call some functions in another program (or Common.asp) that outputs some HTML, then assign function's output to a label instead of printing it directly.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
cruisin
Posts: 31
|
| Posted: 07/22/2005, 2:16 PM |
|
I actually have tried this. I'm just trying to get what works correctly as a response.write in a regular ASP program to convert to Codecharge. There is a function which I have added to the common.asp to generate an array. on the page there is a call to the function which results in a string variable which I am assigning to the page label.
an illustration of the code essentially looks like this.
Dim stringvariable
stringvariable = function ()
' this is where it would have been response.write stringvariable
label1.value = stringvariable
I'm just not getting any output, and there aren't any bugs to debug. 
|
 |
 |
peterr
Posts: 5971
|
| Posted: 07/22/2005, 2:25 PM |
|
I recommend that you debug your code. The standard method to do this is to check which part of the code works and which doesn't.
So first try:
Dim stringvariable
stringvariable = function ()
Response.Write stringvariable
Response.End
Then try:
label1.value = "abc"
If both of the above code snippets work then there is no reason that your code wouldn't work. If one of them doesn't work then you can research or debug that part.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |