From 3064a2e196ea17b6016d80c61a6189110038a509 Mon Sep 17 00:00:00 2001 From: xue <> Date: Fri, 27 Jan 2006 17:25:06 +0000 Subject: Added Persistent State page to quickstart tutorial. --- .../protected/pages/Advanced/MasterContent.page | 1 + .../protected/pages/Advanced/Performance.page | 1 + .../quickstart/protected/pages/Advanced/State.page | 54 ++++++++++++++++++++++ 3 files changed, 56 insertions(+) create mode 100644 demos/quickstart/protected/pages/Advanced/State.page (limited to 'demos/quickstart/protected/pages') diff --git a/demos/quickstart/protected/pages/Advanced/MasterContent.page b/demos/quickstart/protected/pages/Advanced/MasterContent.page index 434bc413..0a68fe31 100644 --- a/demos/quickstart/protected/pages/Advanced/MasterContent.page +++ b/demos/quickstart/protected/pages/Advanced/MasterContent.page @@ -6,6 +6,7 @@ Pages in a Web application often share common portions. For example, all pages o
Master and content only apply to template controls (controls extending TTemplateControl or its child classes). A template control can have at most one master control and one or several contents (each represented by a TContent control). Contents will be inserted into the master control at places reserved by TContentPlaceHolder controls. And the presentation of the template control is that of the master control with TContentPlaceHolder replaced by TContent. +
For example, assume a template control has the following template:
diff --git a/demos/quickstart/protected/pages/Advanced/Performance.page b/demos/quickstart/protected/pages/Advanced/Performance.page index 5aee4a9b..8b10da56 100644 --- a/demos/quickstart/protected/pages/Advanced/Performance.page +++ b/demos/quickstart/protected/pages/Advanced/Performance.page @@ -60,6 +60,7 @@ To switch application mode, configure it in application configuration:By default, PRADO stores page state in hidden fields of the HTML output. The page state could be very large in size if complex controls, such as TDataGrid, is used. To reduce the size of the network transmitted page size, two strategies can be used. +
First, you may disable viewstate by setting EnableViewState to false for the page or some controls on the page if they do not need user interactions. Viewstate is mainly used to keep track of page state when a user interacts with that page.
diff --git a/demos/quickstart/protected/pages/Advanced/State.page b/demos/quickstart/protected/pages/Advanced/State.page new file mode 100644 index 00000000..30d5b2fc --- /dev/null +++ b/demos/quickstart/protected/pages/Advanced/State.page @@ -0,0 +1,54 @@ ++Web applications often need to remember what an end user has done in previous page requests so that the new page request can be served accordingly. State persistence is to address this problem. Traditionally, if a page needs to keep track of user interactions, it will resort to session, cookie, or hidden fields. PRADO provides a new line of state persistence schemes, including view state, control state, and application state. +
+ ++View state lies at the heart of PRADO. With view state, Web pages become stateful and are capable of restoring pages to the state that end users interacted with before the current page request. Web programming thus resembles to Windows GUI programming, and developers can think continuously without worrying about the roundtrips between end users and the Web server. For example, with view state, a textbox control is able to detect if the user input changes the content in the textbox. +
++View state is only available to controls. View state of a control can be disabled by setting its EnableViewState property to false. To store a variable in view state, call the following, +
++where $this refers to the control object, Caption is a unique key identifying the $caption variable stored in viewstate. To retrieve the variable back from view state, call the following, +
++Control state is like view state in every aspect except that control state cannot be disabled. Control state is intended to be used for storing crucial state information without which a page or control may not work properly. +
++To store and retrieve a variable in control state, use the followign commands, +
++Application state refers to data that is persistent across user sessions and page requests. A typical example of application state is the user visit counter. The counter value is persistent even if the current user session terminates. Note, view state and control state are lost if the user requests for a different page, while session state is lost if the user session terminates. +
++To store and retrieve a variable in application state, use the followign commands, +
++PRADO encapsulates the traditional session management in THttpSession module. The module can be accessed from within any component by using $this->Session, where $this refers to the component object. +
+ +