summaryrefslogtreecommitdiff
path: root/demos/quickstart/protected/pages
diff options
context:
space:
mode:
Diffstat (limited to 'demos/quickstart/protected/pages')
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TDataList/Sample1.page50
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TDataList/Sample1.php34
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TDataList/Sample2.page1
3 files changed, 61 insertions, 24 deletions
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TDataList/Sample1.page b/demos/quickstart/protected/pages/Controls/Samples/TDataList/Sample1.page
index d2b94084..467dc239 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TDataList/Sample1.page
+++ b/demos/quickstart/protected/pages/Controls/Samples/TDataList/Sample1.page
@@ -1,26 +1,48 @@
<com:TContent ID="body">
<h1>TDataList Sample 1</h1>
+<p>
+TDataList is good at displaying tabular data in a non-tabular format. The following example displays a list of computer product information in 3 columns.
+</p>
+<p>
+Since the page is mainly for display and does not require user interactions, the viewstate of TDataList is disabled to reduce page size.
+</p>
<com:TDataList
- ID="DataList"
- RepeatColumns="2"
- RepeatDirection="Horizontal"
- ItemStyle.BackColor="blue"
- ItemStyle.Font.Italic="true"
- ItemStyle.ForeColor="white"
- AlternatingItemStyle.BackColor="green"
- SelectedItemStyle.BackColor="red"
- CellPadding="4">
+ ID="DataList"
+ EnableViewState="false"
+ RepeatColumns="3"
+ RepeatDirection="Horizontal"
+ ItemStyle.Font.Italic="true"
+ ItemStyle.BackColor="lightgreen"
+ HeaderStyle.BackColor="#AAAADD"
+ FooterStyle.BackColor="#DDAAAA"
+ AlternatingItemStyle.BackColor="lightyellow">
+
+<prop:HeaderTemplate>
+<div style="font-weight:bold; text-align:center;">Computer Parts</div>
+</prop:HeaderTemplate>
+
+<prop:FooterTemplate>
+<div style="font-weight:bold; text-align:center;">
+Total <%# $this->Parent->Parent->ItemCount %> products.
+</div>
+</prop:FooterTemplate>
<prop:ItemTemplate>
-<%#$this->Parent->DataItem['name']%>
+<table border="1" width="100%">
+<tr>
+ <th>ID</th><th>Name</th><th>Quantity</th><th>Price</th>
+</tr>
+<tr>
+ <td align="right"><%#$this->Parent->DataItem['id'] %></td>
+ <td align="right"><%#$this->Parent->DataItem['name'] %></td>
+ <td align="right"><%#$this->Parent->DataItem['quantity'] %></td>
+ <td align="right">$<%#$this->Parent->DataItem['price'] %></td>
+</tr>
+</table>
</prop:ItemTemplate>
-<prop:AlternatingItemTemplate>
-<%#$this->Parent->DataItem['name']%>
-</prop:AlternatingItemTemplate>
-
</com:TDataList>
</com:TContent> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TDataList/Sample1.php b/demos/quickstart/protected/pages/Controls/Samples/TDataList/Sample1.php
index 43b2f004..7b8a2ae4 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TDataList/Sample1.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TDataList/Sample1.php
@@ -2,23 +2,39 @@
class Sample1 extends TPage
{
- protected function getDataSource()
+ protected function getData()
{
return array(
- array('name'=>'John','age'=>'31'),
- array('name'=>'Bea','age'=>'35'),
- array('name'=>'Rose','age'=>'33'),
- array('name'=>'Diane','age'=>'37'),
- array('name'=>'Bob','age'=>'30'),
+ array('id'=>'ITN001','name'=>'Motherboard','quantity'=>1,'price'=>100.00,'imported'=>true),
+ array('id'=>'ITN002','name'=>'CPU','quantity'=>1,'price'=>150.00,'imported'=>true),
+ array('id'=>'ITN003','name'=>'Harddrive','quantity'=>2,'price'=>80.00,'imported'=>true),
+ array('id'=>'ITN004','name'=>'Sound card','quantity'=>1,'price'=>40.00,'imported'=>false),
+ array('id'=>'ITN005','name'=>'Video card','quantity'=>1,'price'=>150.00,'imported'=>true),
+ array('id'=>'ITN006','name'=>'Keyboard','quantity'=>1,'price'=>20.00,'imported'=>false),
+ array('id'=>'ITN007','name'=>'Monitor','quantity'=>2,'price'=>300.00,'imported'=>true),
+ array('id'=>'ITN008','name'=>'CDRW drive','quantity'=>1,'price'=>40.00,'imported'=>true),
+ array('id'=>'ITN009','name'=>'Cooling fan','quantity'=>2,'price'=>10.00,'imported'=>false),
+ array('id'=>'ITN010','name'=>'Video camera','quantity'=>20,'price'=>30.00,'imported'=>true),
+ array('id'=>'ITN011','name'=>'Card reader','quantity'=>10,'price'=>24.00,'imported'=>true),
+ array('id'=>'ITN012','name'=>'Floppy drive','quantity'=>50,'price'=>12.00,'imported'=>false),
+ array('id'=>'ITN013','name'=>'CD drive','quantity'=>25,'price'=>20.00,'imported'=>true),
+ array('id'=>'ITN014','name'=>'DVD drive','quantity'=>15,'price'=>80.00,'imported'=>true),
+ array('id'=>'ITN015','name'=>'Mouse pad','quantity'=>50,'price'=>5.00,'imported'=>false),
+ array('id'=>'ITN016','name'=>'Network cable','quantity'=>40,'price'=>8.00,'imported'=>true),
+ array('id'=>'ITN017','name'=>'Case','quantity'=>8,'price'=>65.00,'imported'=>false),
+ array('id'=>'ITN018','name'=>'Surge protector','quantity'=>45,'price'=>15.00,'imported'=>false),
+ array('id'=>'ITN019','name'=>'Speaker','quantity'=>35,'price'=>65.00,'imported'=>false),
);
}
public function onLoad($param)
{
parent::onLoad($param);
- $this->DataList->DataSource=$this->getDataSource();
- $this->DataList->SelectedItemIndex=2;
- $this->DataList->dataBind();
+ if(!$this->IsPostBack)
+ {
+ $this->DataList->DataSource=$this->Data;
+ $this->DataList->dataBind();
+ }
}
}
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TDataList/Sample2.page b/demos/quickstart/protected/pages/Controls/Samples/TDataList/Sample2.page
index 16adf66b..51ec7a7d 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TDataList/Sample2.page
+++ b/demos/quickstart/protected/pages/Controls/Samples/TDataList/Sample2.page
@@ -15,7 +15,6 @@ Be aware, for simplicity, this application does not do any input validation. In
OnUpdateCommand="updateItem"
OnDeleteCommand="deleteItem"
OnSelectedIndexChanged="selectItem"
- HeaderStyle.BackColor="#AAAADD"
ItemStyle.BackColor="#EEEEEE"
AlternatingItemStyle.BackColor="#F5F5F5"
EditItemStyle.BackColor="lightgreen"