CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 Possibly Stupid Question: Adding Page Level Variables

Print topic Send  topic

Author Message
Suntower

Posts: 225
Posted: 08/20/2006, 10:55 AM

How does one declare (DIM) variables which are available to the PAGE and not the Session? I can't see an event to put them into.

TIA,

---JC
_________________
---On a campaign for more examples and better docs!
View profile  Send private message
peterr


Posts: 5971
Posted: 08/20/2006, 1:34 PM

You would declare them in the white areas between events. Keep in mind that each page is executed twice: 1st time when the page is shown, and 2nd time when the page is submitted. All variables except sessions will be lost when the page is executed each time, thus it's not possible to declare a variable that will work in all events.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
Suntower

Posts: 225
Posted: 08/20/2006, 1:54 PM

Possibly -really- stupid reply: I thought one was not supposed to use those white areas, since I seem to recall them being overwritten as the page is changed.

Are they really -safe- to use? IOW: I won't lose my edits as the page changes?

THANKS!

---JC

Quote peterr:
You would declare them in the white areas between events. Keep in mind that each page is executed twice: 1st time when the page is shown, and 2nd time when the page is submitted. All variables except sessions will be lost when the page is executed each time, thus it's not possible to declare a variable that will work in all events.

_________________
---On a campaign for more examples and better docs!
View profile  Send private message
peterr


Posts: 5971
Posted: 08/20/2006, 6:01 PM

White areas are empty and OK to modify. Only avoid modifying code in gray areas, except events.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
DonB
Posted: 08/23/2006, 5:44 PM

Safe - yes. But I prefer to write custom code in separate files, then add
'include' statements to load my separate files. That way I KNOW they won't
get eaten (at least nothing more than my include would ever be lost). Plus
it's just easier (for me) to maintain.

--
DonB

http://www.gotodon.com/ccbth


"Suntower" <Suntower@forum.codecharge> wrote in message
news:644e8cbf47a156@news.codecharge.com...
> Possibly -really- stupid reply: I thought one was not supposed to use
those
> white areas, since I seem to recall them being overwritten as the page is
> changed.
>
> Are they really -safe- to use? IOW: I won't lose my edits as the page
changes?
>
> THANKS!
>
> ---JC
>
>
Quote peterr:
> You would declare them in the white areas between events. Keep in mind
that
> each page is executed twice: 1st time when the page is shown, and 2nd time
when
> the page is submitted. All variables except sessions will be lost when the
page
> is executed each time, thus it's not possible to declare a variable that
will
> work in all events.
>
>
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

Suntower

Posts: 225
Posted: 08/28/2006, 11:39 AM

Hello Don,

Can you be a bit more specific as to the procedure? I can see how to include files for JS or HTML styles, but how does one include a page for declaring page level variables? Do you put it in an Event? If so, which one?

THANKS!

---JC


Quote DonB:
Safe - yes. But I prefer to write custom code in separate files, then add
'include' statements to load my separate files. That way I KNOW they won't
get eaten (at least nothing more than my include would ever be lost). Plus
it's just easier (for me) to maintain.

--
DonB

http://www.gotodon.com/ccbth


"Suntower" <Suntower@forum.codecharge> wrote in message
news:644e8cbf47a156@news.codecharge.com...
> Possibly -really- stupid reply: I thought one was not supposed to use
those
> white areas, since I seem to recall them being overwritten as the page is
> changed.
>
> Are they really -safe- to use? IOW: I won't lose my edits as the page
changes?
>
> THANKS!
>
> ---JC
>
>
Quote peterr:
> You would declare them in the white areas between events. Keep in mind
that
> each page is executed twice: 1st time when the page is shown, and 2nd time
when
> the page is submitted. All variables except sessions will be lost when the
page
> is executed each time, thus it's not possible to declare a variable that
will
> work in all events.
>
>
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>



_________________
---On a campaign for more examples and better docs!
View profile  Send private message
Benjamin Krajmalnik
Posted: 08/28/2006, 12:34 PM

JC,

What I do is place the includes for anything that is global in the first
line of the _events page.

So, for example, if I have a charts page, the first line of
charts_events.asp may have something along the lines of:

<!-- #INCLUDE FILE="FGWrapper.asp" -->

<%
Dim DataType, BaseDate, StartDate, EndDate, graph


'BindEvents Method @1-7F418D9D
Sub BindEvents()


In here you can see 2 things. First, the inclusion of an external class
file.
Second, you will notice that the very first line after the opening "<%" has
my global page variables defined.
These are used by multiple charts which are presentedon the same page, so I
only want to retrieve them one. In this case, they are CCGetParam's, in the
AfterPageInitialize event.

You could declare these anywhere in the whitespace area - I prefer to do
this at the very top for consistency.

Also, when you include a page, make sure it is not inside the <% - %>.


Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.