From 0dcd473e9939501be6a320cb6cd185f750042d58 Mon Sep 17 00:00:00 2001
From: xue <>
Date: Thu, 26 Jan 2006 14:33:14 +0000
Subject: Added description about databinding for list controls.
---
.../quickstart/protected/pages/Controls/List.page | 38 +++++++++++++++++++---
.../protected/pages/Fundamentals/Services.page | 4 +--
2 files changed, 36 insertions(+), 6 deletions(-)
(limited to 'demos/quickstart/protected/pages')
diff --git a/demos/quickstart/protected/pages/Controls/List.page b/demos/quickstart/protected/pages/Controls/List.page
index dd5c9002..653e52d4 100644
--- a/demos/quickstart/protected/pages/Controls/List.page
+++ b/demos/quickstart/protected/pages/Controls/List.page
@@ -3,6 +3,7 @@
List Controls
List controls covered in this section all inherit directly or indirectly from TListControl. Therefore, they share the same set of commonly used properties, including,
+
- Items - list of items in the control. The items are of type TListItem. The item list can be populated via databinding or specified in templates like the following:
@@ -20,10 +21,37 @@ List controls covered in this section all inherit directly or indirectly from AutoPostBack - whether changing the selection of the control should trigger postback.
- CausesValidation - whether validation should be performed when postback is triggered by the list control.
-
+
-Since TListControl inherits from TDataBoundControl, these list controls also share a common operation known as databinding. The data to be bound can be specified via either DataSource or DataSourceID. More details about databinding are covered in later chapters of this tutorial.
+Since TListControl inherits from TDataBoundControl, these list controls also share a common operation known as databinding. The Items can be populated from preexisting data specified by DataSource or DataSourceID. A function call to dataBind() will cause the data population. For list controls, data can be specified in three kinds of format:
+
+ - integer-indexed array : each array element value will be used as the value and text for a list item. For example
+
+$listbox->DataSource=array('item 1','item 2','item 3');
+$listbox->dataBind();
+
+
+ - associative array : array keys will be used as list item values, and array values will be used as list item texts. For example
+
+$listbox->DataSource=array(
+ 'key 1'=>'item 1',
+ 'key 2'=>'item 2',
+ 'key 3'=>'item 3');
+$listbox->dataBind();
+
+
+ - tabular (two-dimensional) data : each row of data populates a single list item. The list item value is specified by the data member indexed with DataValueField, and the list item text by DataTextField. For example,
+
+$listbox->DataTextField='name';
+$listbox->DataValueField='id';
+$listbox->DataSource=array(
+ array('id'=>'001','name'=>'John','age'=>31),
+ array('id'=>'002','name'=>'Mary','age'=>30),
+ array('id'=>'003','name'=>'Cary','age'=>20));
+$listbox->dataBind();
+
+
TListBox
@@ -40,12 +68,13 @@ Since TListControl inherits from TDataBoundControl, these list
TCheckBoxList
TCheckBoxList displays a list of checkboxes on a Web page. The alignment of the text besides each checkbox can be specified TextAlign. The layout of the checkboxes can be controlled by the following properties:
+
- RepeatLayout - can be either Table or Flow. A Table uses HTML table cells to organize the checkboxes, while a Flow uses HTML span tags and breaks for the organization. With Table layout, you can set CellPadding and CellSpacing.
- RepeatColumns - how many columns the checkboxes should be displayed in.
- RepeatDirection - how to traverse the checkboxes, in a horizontal way or a vertical way (because the checkboxes are displayed in a matrix-like layout).
-
+
TRadioButtonList
@@ -60,12 +89,13 @@ Since TListControl inherits from TDataBoundControl, these list
TBulletedList displays the item texts in three different modes,
+
- Text - the item texts are displayed as static texts;
- HyperLink - each item is displayed as a hyperlink whose URL is given by the item value, and Target property can be used to specify the target browser window;
- LinkButton - each item is displayed as a link button which posts back to the page if a user clicks on that, and the event OnClick will be raised under such a circumstance.
-
+
\ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Fundamentals/Services.page b/demos/quickstart/protected/pages/Fundamentals/Services.page
index 031eac60..22c09c99 100644
--- a/demos/quickstart/protected/pages/Fundamentals/Services.page
+++ b/demos/quickstart/protected/pages/Fundamentals/Services.page
@@ -24,8 +24,8 @@ Pages may be organized into subdirectories under the BasePath. In each
Service parameter for the page service refers to the page being requested. A parameter like Fundamentals.Services refers to the Services page under the <BasePath>/Fundamentals directory. If such a parameter is absent in a request, a default page named Home is assumed. Using THttpRequest as the request module (default), the following URLs will request for Home, About and Register pages, respectively,
-http://hostname/index.php
-http://hostname/index.php?page=About
+http://hostname/index.php
+http://hostname/index.php?page=About
http://hostname/index.php?page=Users.Register
where the first example takes advantage of the fact that the page service is the default service and Home is the default page.
--
cgit v1.2.3