summaryrefslogtreecommitdiff
path: root/demos
diff options
context:
space:
mode:
authorctrlaltca@gmail.com <>2011-06-02 09:30:55 +0000
committerctrlaltca@gmail.com <>2011-06-02 09:30:55 +0000
commit8aa0d56705a71894a80c1293730b6c67cddc8a40 (patch)
treefda6cea608f8fe2ade2f9a4f51e39c54846a3b17 /demos
parent3baba6fb4b6c17ff77eb4a13a812ccde9263dce2 (diff)
added documentation for TActiveDataList, TActiveDataGrid and TActiveRepeater class
Diffstat (limited to 'demos')
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/ActiveDataGrid.page83
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/ActiveDataList.page23
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/ActiveRepeater.page24
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/Home.page6
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample1.page18
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample1.php37
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample2.page64
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample2.php86
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample3.page83
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample3.php190
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample4.page55
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample4.php21
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample5.page25
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample5.php79
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataList/Home.page125
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataList/Home.php132
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/Home.page92
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/Home.php79
-rw-r--r--demos/quickstart/protected/pages/Controls/DataGrid.page3
-rw-r--r--demos/quickstart/protected/pages/Controls/DataList.page2
-rw-r--r--demos/quickstart/protected/pages/Controls/Repeater.page1
21 files changed, 1224 insertions, 4 deletions
diff --git a/demos/quickstart/protected/pages/ActiveControls/ActiveDataGrid.page b/demos/quickstart/protected/pages/ActiveControls/ActiveDataGrid.page
new file mode 100644
index 00000000..9a82743d
--- /dev/null
+++ b/demos/quickstart/protected/pages/ActiveControls/ActiveDataGrid.page
@@ -0,0 +1,83 @@
+<com:TContent ID="body" >
+
+<h1 id="5201">TActiveDataGrid</h1>
+<com:DocLink ClassPath="System.Web.UI.ActiveControls.TActiveDataGrid" />
+
+<p class="block-content">
+<tt>TActiveDataGrid</tt> represents a data bound and updatable grid control which is the
+active counterpart to the original <tt>TDataGrid</tt> control.
+</p>
+
+<p class="block-content">
+This component can be used in the same way as the regular datagrid, the only
+difference is that the active datagrid uses callbacks instead of postbacks
+for interaction.
+</p>
+
+<p class="block-content">
+PRADO provides eight new types of active columns that can be used inside <tt>TActiveDataGrid</tt>;
+they are the active counterpart of <tt>TDataGrid</tt>'s columns:
+</p>
+<ul class="block-content">
+ <li><tt>TActiveBoundColumn</tt> associates cells with a specific field of data and displays the cells according to their modes.</li>
+ <li><tt>TActiveLiteralColumn</tt> associates cells with a specific field of data and displays the cells with static texts.</li>
+ <li><tt>TActiveCheckBoxColumn</tt> associates cells with a specific field of data and displays in each cell a checkbox whose check state is determined by the data field value.</li>
+ <li><tt>TActiveDropDownListColumn</tt> associates cells with a specific field of data and displays the cells according to their modes. If in edit mode, a cell will be displayed with a <tt>TDropDownList</tt>.</li>
+ <li><tt>TActiveHyperLinkColumn</tt> displays in the cells a hyperlink whose caption and URL can be either statically specified or bound to some fields of data.</li>
+ <li><tt>TActiveEditCommandColumn</tt> displays in the cells edit/update/cancel command buttons according to the state of the item that a cell resides in.</li>
+ <li><tt>TActiveButtonColumn</tt> displays in the cells a command button.</li>
+ <li><tt>TActiveTemplateColumn</tt> displays the cells according to different templates defined for it.</li>
+</ul>
+
+<p class="block-content">
+Please refer to the original documentation of <a href="?page=Controls.DataGrid">TDataGrid</a> for basic usage.
+</p>
+
+
+<h2>Columns</h2>
+
+<h3>Automatically Generated Columns</h3>
+<p class="block-content">
+TDataGrid by default will create a list of columns based on the structure of the bound data. TDataGrid will read the first row of the data, extract the field names of the row, and construct a column for each field. Each column is of type <tt>TActiveBoundColumn</tt>. All of this happens in an ajax callback.
+</p>
+
+<com:RunBar PagePath="ActiveControls.Samples.TActiveDataGrid.Sample1" />
+
+<h3>Manually Specified Columns</h3>
+<p class="block-content">
+The following example uses manually specified columns to show a list of book information,
+</p>
+<ul id="u4" class="block-content">
+ <li>Book title - displayed as a hyperlink pointing to the corresponding amazon.com book page. <tt>TActiveHyperLinkColumn</tt> is used.</li>
+ <li>Publisher - displayed as a piece of text using <tt>TvBoundColumn</tt>.</li>
+ <li>Price - displayed as a piece of text using <tt>TActiveBoundColumn</tt> with output formatting string and customized styles.</li>
+ <li>In-stock or not - displayed as a checkbox using <tt>TActiveCheckBoxColumn</tt>.</li>
+ <li>Rating - displayed as an image using <tt>TActiveTemplateColumn</tt> which allows maximum freedom in specifying cell contents.</li>
+</ul>
+<p class="block-content">
+Each column can be shown or hidden in a callback.
+</p>
+<com:RunBar PagePath="ActiveControls.Samples.TActiveDataGrid.Sample2" />
+
+
+<h2>Interacting with TActiveDataGrid</h2>
+<p class="block-content">
+The following example shows how to make the previous book information table an interactive one. It allows users to edit and delete book items from the table. Two additional columns are used in the example to allow users interact with the datagrid: <tt>TActiveEditCommandColumn</tt> and <tt>TActiveButtonColumn</tt>. In addition,
+<tt>TActiveDropDownListColumn</tt> replaces the previous <tt>TActiveTemplateColumn</tt> to allow users to select a rating from a dropdown list. Note, it is also possible to use <tt>TActiveTemplateColumn</tt> to achieve the same task.
+All the iteration is done using AJAX callbacks.
+</p>
+<com:RunBar PagePath="ActiveControls.Samples.TActiveDataGrid.Sample3" />
+
+<h2>Sorting</h2>
+<p class="block-content">
+The following example turns the datagrid in <a href="?page=ActiveControls.Samples.TActiveDataGrid.Sample2">Example 2</a> into a sortable one. Users can click on the link button displayed in the header of any column, and the data will be sorted in ascending order along that column. The grid is sorted and rendered upon a callback request.
+</p>
+<com:RunBar PagePath="ActiveControls.Samples.TActiveDataGrid.Sample4" />
+
+<h2>Paging</h2>
+<p class="block-content">
+The following example enables the paging functionality of the datagrid shown in <a href="?page=ActiveControls.Samples.TActiveDataGrid.Sample1">Example 1</a>. In this example, you move between the datagrid pages clicking on the pager links. The grid reacts to paging rendering itself as the result of a callback request. Note that you can't change the pager style upon callback.
+</p>
+<com:RunBar PagePath="ActiveControls.Samples.TActiveDataGrid.Sample5" />
+
+<div class="last-modified">$Id$</div></com:TContent> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/ActiveControls/ActiveDataList.page b/demos/quickstart/protected/pages/ActiveControls/ActiveDataList.page
new file mode 100644
index 00000000..12fb941f
--- /dev/null
+++ b/demos/quickstart/protected/pages/ActiveControls/ActiveDataList.page
@@ -0,0 +1,23 @@
+<com:TContent ID="body" >
+
+<h1>TActiveDataList</h1>
+<com:DocLink ClassPath="System.Web.UI.ActiveControls.TActiveDataList" />
+
+<p class="block-content">
+<tt>TActiveDataList</tt> represents a data bound and updatable list control which is the
+active counterpart to the original <tt>TDataList</tt> control.
+</p>
+
+<p class="block-content">
+This component can be used in the same way as the regular datalist, the only
+difference is that the active datalist uses callbacks instead of postbacks
+for interaction.
+</p>
+
+<p class="block-content">
+Please refer to the original documentation of <a href="?page=Controls.DataList">TDataList</a> for usage.
+</p>
+
+<com:RunBar PagePath="ActiveControls.Samples.TActiveDataList.Home" />
+
+<div class="last-modified">$Id$</div></com:TContent> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/ActiveControls/ActiveRepeater.page b/demos/quickstart/protected/pages/ActiveControls/ActiveRepeater.page
new file mode 100644
index 00000000..d22a7467
--- /dev/null
+++ b/demos/quickstart/protected/pages/ActiveControls/ActiveRepeater.page
@@ -0,0 +1,24 @@
+<com:TContent ID="body" >
+
+<h1>TActiveRepeater</h1>
+<com:DocLink ClassPath="System.Web.UI.ActiveControls.TActiveRepeater" />
+
+<p class="block-content">
+<tt>TActiveRepeater</tt> represents a data bound and updatable repeater control which is the
+active counterpart to the original <tt>TRepeater</tt> control.
+</p>
+
+<p class="block-content">
+This component can be used in the same way as the regular repeater, the only
+difference is that the active repeater uses callbacks instead of postbacks
+for interaction.
+</p>
+
+<p class="block-content">
+Please refer to the original documentation of <a href="?page=Controls.Repeater">TRepeater</a> for usage.
+</p>
+
+<com:RunBar PagePath="ActiveControls.Samples.TActiveRepeater.Home" />
+
+
+<div class="last-modified">$Id$</div></com:TContent> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/ActiveControls/Home.page b/demos/quickstart/protected/pages/ActiveControls/Home.page
index 93b5b6eb..798bc267 100644
--- a/demos/quickstart/protected/pages/ActiveControls/Home.page
+++ b/demos/quickstart/protected/pages/ActiveControls/Home.page
@@ -136,19 +136,19 @@ TActiveButton</a> control. See also the later part of the <a href="?page=Tutoria
<h2 id="134001">Active Data Controls</h2>
<ul id="u2" class="block-content">
<li>
- * <a href="?page=ActiveControls.ActiveDataList">TActiveDataList</a>
+ <a href="?page=ActiveControls.ActiveDataList">TActiveDataList</a>
is used to display or modify a list of data items. It is the
active counterpart to the original TDataList control.
</li>
<li>
- * <a href="?page=ActiveControls.ActiveDataGrid">TActiveDataGrid</a>
+ <a href="?page=ActiveControls.ActiveDataGrid">TActiveDataGrid</a>
displays data in a tabular format with rows and columns. It is the
active counterpart to the original TDataGrid control.
</li>
<li>
- * <a href="?page=ActiveControls.ActiveRepeater">TActiveRepeater</a>
+ <a href="?page=ActiveControls.ActiveRepeater">TActiveRepeater</a>
displays its content defined in templates repeatedly based on the given data.
It is the active counterpart to the original TRepeater control.
</li>
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample1.page b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample1.page
new file mode 100644
index 00000000..28d91dc0
--- /dev/null
+++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample1.page
@@ -0,0 +1,18 @@
+<com:TContent ID="body">
+
+<h1>TActiveDataGrid Sample 1</h1>
+<h2>Using Automatically Generated Columns</h2>
+
+<com:TActiveButton ID="button1" Text="click me" OnCallback="buttonClicked" />
+<com:TActiveDataGrid
+ ID="DataGrid"
+ EnableViewState="false"
+ CellPadding="2"
+ HeaderStyle.BackColor="black"
+ HeaderStyle.ForeColor="white"
+ ItemStyle.BackColor="#BFCFFF"
+ ItemStyle.Font.Italic="true"
+ AlternatingItemStyle.BackColor="#E6ECFF"
+ />
+
+<div class="last-modified">$Id$</div></com:TContent> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample1.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample1.php
new file mode 100644
index 00000000..ada1ee6e
--- /dev/null
+++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample1.php
@@ -0,0 +1,37 @@
+<?php
+
+class Sample1 extends TPage
+{
+ protected function getData()
+ {
+ return array(
+ 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 buttonClicked($sender, $param)
+ {
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+}
+
+?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample2.page b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample2.page
new file mode 100644
index 00000000..5f5f99da
--- /dev/null
+++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample2.page
@@ -0,0 +1,64 @@
+<com:TContent ID="body">
+
+<h1>TActiveDataGrid Sample 2</h1>
+<h2>Using Manually Specified Columns</h2>
+
+<com:TActiveDataGrid
+ Width="700px"
+ CellPadding="2"
+ ID="DataGrid"
+ AutoGenerateColumns="false"
+ HeaderStyle.BackColor="black"
+ HeaderStyle.ForeColor="white"
+ ItemStyle.BackColor="#BFCFFF"
+ ItemStyle.Font.Italic="true"
+ AlternatingItemStyle.BackColor="#E6ECFF">
+
+ <com:TActiveHyperLinkColumn
+ HeaderText="Book Title"
+ DataTextField="title"
+ DataNavigateUrlField="ISBN"
+ DataNavigateUrlFormatString="http://www.amazon.com/gp/product/%s"
+ Target="_blank"
+ />
+ <com:TActiveBoundColumn
+ HeaderText="Publisher"
+ DataField="publisher"
+ />
+ <com:TActiveBoundColumn
+ ItemStyle.HorizontalAlign="Right"
+ ItemStyle.Wrap="false"
+ ItemStyle.Font.Italic="false"
+ ItemStyle.ForeColor="green"
+ HeaderText="Price"
+ DataField="price"
+ DataFormatString="$%.2f"
+ />
+ <com:TActiveCheckBoxColumn
+ HeaderText="In-stock"
+ HeaderStyle.Wrap="false"
+ DataField="instock"
+ />
+ <com:TActiveTemplateColumn>
+ <prop:HeaderTemplate>Rating</prop:HeaderTemplate>
+ <prop:ItemTemplate>
+ <img src="images/star<%#$this->Parent->DataItem['rating']%>.gif" alt="" />
+ </prop:ItemTemplate>
+ </com:TActiveTemplateColumn>
+</com:TActiveDataGrid>
+
+<com:TPanel GroupingText="Column Visibility" Width="200px">
+
+<com:TActiveCheckBoxList
+ AutoPostBack="true"
+ OnSelectedIndexChanged="toggleColumnVisibility">
+ <com:TListItem Text="Book Title" Selected="true" />
+ <com:TListItem Text="Publisher" Selected="true" />
+ <com:TListItem Text="Price" Selected="true" />
+ <com:TListItem Text="In-stock" Selected="true" />
+ <com:TListItem Text="Rating" Selected="true" />
+</com:TActiveCheckBoxList>
+
+</com:TPanel>
+
+<div class="last-modified">$Id$</div></com:TContent> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample2.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample2.php
new file mode 100644
index 00000000..3831582d
--- /dev/null
+++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample2.php
@@ -0,0 +1,86 @@
+<?php
+
+class Sample2 extends TPage
+{
+ protected function getData()
+ {
+ return array(
+ array(
+ 'ISBN'=>'0596007124',
+ 'title'=>'Head First Design Patterns',
+ 'publisher'=>'O\'Reilly Media, Inc.',
+ 'price'=>29.67,
+ 'instock'=>true,
+ 'rating'=>4,
+ ),
+ array(
+ 'ISBN'=>'0201633612',
+ 'title'=>'Design Patterns: Elements of Reusable Object-Oriented Software',
+ 'publisher'=>'Addison-Wesley Professional',
+ 'price'=>47.04,
+ 'instock'=>true,
+ 'rating'=>5,
+ ),
+ array(
+ 'ISBN'=>'0321247140',
+ 'title'=>'Design Patterns Explained : A New Perspective on Object-Oriented Design',
+ 'publisher'=>'Addison-Wesley Professional',
+ 'price'=>37.49,
+ 'instock'=>true,
+ 'rating'=>4,
+ ),
+ array(
+ 'ISBN'=>'0201485672',
+ 'title'=>'Refactoring: Improving the Design of Existing Code',
+ 'publisher'=>'Addison-Wesley Professional',
+ 'price'=>47.14,
+ 'instock'=>true,
+ 'rating'=>3,
+ ),
+ array(
+ 'ISBN'=>'0321213351',
+ 'title'=>'Refactoring to Patterns',
+ 'publisher'=>'Addison-Wesley Professional',
+ 'price'=>38.49,
+ 'instock'=>true,
+ 'rating'=>2,
+ ),
+ array(
+ 'ISBN'=>'0735619670',
+ 'title'=>'Code Complete',
+ 'publisher'=>'Microsoft Press',
+ 'price'=>32.99,
+ 'instock'=>false,
+ 'rating'=>4,
+ ),
+ array(
+ 'ISBN'=>'0321278658',
+ 'title'=>'Extreme Programming Explained : Embrace Change',
+ 'publisher'=>'Addison-Wesley Professional',
+ 'price'=>34.99,
+ 'instock'=>true,
+ 'rating'=>3,
+ ),
+ );
+ }
+
+ public function onLoad($param)
+ {
+ parent::onLoad($param);
+ if(!$this->IsPostBack && !$this->IsCallBack)
+ {
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+ }
+
+ public function toggleColumnVisibility($sender,$param)
+ {
+ foreach($this->DataGrid->Columns as $index=>$column)
+ $column->Visible=$sender->Items[$index]->Selected;
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+}
+
+?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample3.page b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample3.page
new file mode 100644
index 00000000..21ff8fc8
--- /dev/null
+++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample3.page
@@ -0,0 +1,83 @@
+<com:TContent ID="body">
+
+<h1>TActiveDataGrid Sample 3</h1>
+<h2>Interacting with TActiveDataGrid</h2>
+
+<com:TActiveDataGrid
+ Width="800px"
+ CellPadding="2"
+ ID="DataGrid"
+ DataKeyField="ISBN"
+ AutoGenerateColumns="false"
+ HeaderStyle.BackColor="black"
+ HeaderStyle.ForeColor="white"
+ ItemStyle.BackColor="#BFCFFF"
+ ItemStyle.Font.Italic="true"
+ AlternatingItemStyle.BackColor="#E6ECFF"
+ EditItemStyle.BackColor="lightyellow"
+ OnItemCreated="itemCreated"
+ OnEditCommand="editItem"
+ OnUpdateCommand="saveItem"
+ OnCancelCommand="cancelItem"
+ OnDeleteCommand="deleteItem"
+ >
+
+ <com:TActiveBoundColumn
+ ID="BookTitleColumn"
+ HeaderText="Book Title"
+ HeaderStyle.Width="400px"
+ DataField="title"
+ />
+ <com:TActiveBoundColumn
+ ID="PublisherColumn"
+ HeaderText="Publisher"
+ HeaderStyle.Width="150px"
+ DataField="publisher"
+ />
+ <com:TActiveBoundColumn
+ ID="PriceColumn"
+ ItemStyle.HorizontalAlign="Right"
+ ItemStyle.Wrap="false"
+ ItemStyle.Font.Italic="false"
+ ItemStyle.ForeColor="green"
+ HeaderText="Price"
+ HeaderStyle.Width="70px"
+ DataField="price"
+ DataFormatString="$%.2f"
+ />
+ <com:TActiveCheckBoxColumn
+ ID="InStockColumn"
+ HeaderText="In-stock"
+ DataField="instock"
+ />
+ <com:TActiveDropDownListColumn
+ ID="RatingColumn"
+ HeaderText="Rating"
+ DataTextField="rating"
+ >
+ <prop:DataTextFormatString><img src="images/star%s.gif" alt="" /></prop:DataTextFormatString>
+ <com:TListItem Value="1" />
+ <com:TListItem Value="2" />
+ <com:TListItem Value="3" />
+ <com:TListItem Value="4" />
+ <com:TListItem Value="5" />
+ </com:TActiveDropDownListColumn>
+ <com:TActiveEditCommandColumn
+ HeaderText="Edit"
+ HeaderStyle.Width="100px"
+ UpdateText="Save"
+ ItemStyle.HorizontalAlign="Center"
+ ItemStyle.Font.Italic="false"
+ />
+ <com:TActiveButtonColumn
+ ID="DeleteColumn"
+ HeaderText="Delete"
+ HeaderStyle.Width="50px"
+ ItemStyle.HorizontalAlign="Center"
+ ItemStyle.Font.Italic="false"
+ Text="Delete"
+ CommandName="delete"
+ />
+</com:TActiveDataGrid>
+
+<div class="last-modified">$Id$</div></com:TContent> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample3.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample3.php
new file mode 100644
index 00000000..9768ca31
--- /dev/null
+++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample3.php
@@ -0,0 +1,190 @@
+<?php
+
+class Sample3 extends TPage
+{
+ private $_data=null;
+
+ protected function getData()
+ {
+ if($this->_data===null)
+ $this->loadData();
+ return $this->_data;
+ }
+
+ protected function loadData()
+ {
+ // We use viewstate keep track of data.
+ // In real applications, data should come from database using an SQL SELECT statement.
+ // In the following tabular data, field 'ISBN' is the primary key.
+ // All update and delete operations should come with an 'id' value in order to go through.
+ if(($this->_data=$this->getViewState('Data',null))===null)
+ {
+ $this->_data=array(
+ array(
+ 'ISBN'=>'0596007124',
+ 'title'=>'Head First Design Patterns',
+ 'publisher'=>'O\'Reilly Media, Inc.',
+ 'price'=>29.67,
+ 'instock'=>true,
+ 'rating'=>4,
+ ),
+ array(
+ 'ISBN'=>'0201633612',
+ 'title'=>'Design Patterns: Elements of Reusable Object-Oriented Software',
+ 'publisher'=>'Addison-Wesley Professional',
+ 'price'=>47.04,
+ 'instock'=>true,
+ 'rating'=>5,
+ ),
+ array(
+ 'ISBN'=>'0321247140',
+ 'title'=>'Design Patterns Explained : A New Perspective on Object-Oriented Design',
+ 'publisher'=>'Addison-Wesley Professional',
+ 'price'=>37.49,
+ 'instock'=>true,
+ 'rating'=>4,
+ ),
+ array(
+ 'ISBN'=>'0201485672',
+ 'title'=>'Refactoring: Improving the Design of Existing Code',
+ 'publisher'=>'Addison-Wesley Professional',
+ 'price'=>47.14,
+ 'instock'=>true,
+ 'rating'=>3,
+ ),
+ array(
+ 'ISBN'=>'0321213351',
+ 'title'=>'Refactoring to Patterns',
+ 'publisher'=>'Addison-Wesley Professional',
+ 'price'=>38.49,
+ 'instock'=>true,
+ 'rating'=>2,
+ ),
+ array(
+ 'ISBN'=>'0735619670',
+ 'title'=>'Code Complete',
+ 'publisher'=>'Microsoft Press',
+ 'price'=>32.99,
+ 'instock'=>false,
+ 'rating'=>4,
+ ),
+ array(
+ 'ISBN'=>'0321278658 ',
+ 'title'=>'Extreme Programming Explained : Embrace Change',
+ 'publisher'=>'Addison-Wesley Professional',
+ 'price'=>34.99,
+ 'instock'=>true,
+ 'rating'=>3,
+ ),
+ );
+ $this->saveData();
+ }
+ }
+
+ protected function saveData()
+ {
+ $this->setViewState('Data',$this->_data);
+ }
+
+ protected function updateBook($isbn,$title,$publisher,$price,$instock,$rating)
+ {
+ // In real applications, data should be saved to database using an SQL UPDATE statement
+ if($this->_data===null)
+ $this->loadData();
+ $updateRow=null;
+ foreach($this->_data as $index=>$row)
+ if($row['ISBN']===$isbn)
+ $updateRow=&$this->_data[$index];
+ if($updateRow!==null)
+ {
+ $updateRow['title']=$title;
+ $updateRow['publisher']=$publisher;
+ $updateRow['price']=TPropertyValue::ensureFloat(ltrim($price,'$'));
+ $updateRow['instock']=TPropertyValue::ensureBoolean($instock);
+ $updateRow['rating']=TPropertyValue::ensureInteger($rating);
+ $this->saveData();
+ }
+ }
+
+ protected function deleteBook($isbn)
+ {
+ // In real applications, data should be saved to database using an SQL DELETE statement
+ if($this->_data===null)
+ $this->loadData();
+ $deleteIndex=-1;
+ foreach($this->_data as $index=>$row)
+ if($row['ISBN']===$isbn)
+ $deleteIndex=$index;
+ if($deleteIndex>=0)
+ {
+ unset($this->_data[$deleteIndex]);
+ $this->saveData();
+ }
+ }
+
+ public function onLoad($param)
+ {
+ parent::onLoad($param);
+ if(!$this->IsPostBack && !$this->IsCallBack)
+ {
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+ }
+
+ public function itemCreated($sender,$param)
+ {
+ $item=$param->Item;
+ if($item->ItemType==='EditItem')
+ {
+ // set column width of textboxes
+ $item->BookTitleColumn->TextBox->Columns=40;
+ $item->PriceColumn->TextBox->Columns=5;
+ }
+ if($item->ItemType==='Item' || $item->ItemType==='AlternatingItem' || $item->ItemType==='EditItem')
+ {
+ // add an aleart dialog to delete buttons
+ $item->DeleteColumn->Button->Attributes->onclick='if(!confirm(\'Are you sure?\')) return false;';
+ }
+ }
+
+ public function editItem($sender,$param)
+ {
+ $this->DataGrid->EditItemIndex=$param->Item->ItemIndex;
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+
+ public function saveItem($sender,$param)
+ {
+ $item=$param->Item;
+ $this->updateBook(
+ $this->DataGrid->DataKeys[$item->ItemIndex], // ISBN
+ $item->BookTitleColumn->TextBox->Text, // title
+ $item->PublisherColumn->TextBox->Text, // publisher
+ $item->PriceColumn->TextBox->Text, // price
+ $item->InStockColumn->CheckBox->Checked, // instock
+ $item->RatingColumn->DropDownList->SelectedValue // rating
+ );
+ $this->DataGrid->EditItemIndex=-1;
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+
+ public function cancelItem($sender,$param)
+ {
+ $this->DataGrid->EditItemIndex=-1;
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+
+ public function deleteItem($sender,$param)
+ {
+ $this->deleteBook($this->DataGrid->DataKeys[$param->Item->ItemIndex]);
+ $this->DataGrid->EditItemIndex=-1;
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+}
+
+?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample4.page b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample4.page
new file mode 100644
index 00000000..38def9c0
--- /dev/null
+++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample4.page
@@ -0,0 +1,55 @@
+<com:TContent ID="body">
+
+<h1>TActiveDataGrid Sample 4</h1>
+<h2>Sorting with TActiveDataGrid</h2>
+
+<com:TActiveDataGrid
+ Width="700px"
+ CellPadding="2"
+ ID="DataGrid"
+ AutoGenerateColumns="false"
+ HeaderStyle.BackColor="black"
+ HeaderStyle.ForeColor="white"
+ ItemStyle.BackColor="#BFCFFF"
+ ItemStyle.Font.Italic="true"
+ AlternatingItemStyle.BackColor="#E6ECFF"
+ AllowSorting="true"
+ OnSortCommand="sortDataGrid">
+
+ <com:TActiveHyperLinkColumn
+ SortExpression="title"
+ HeaderText="Book Title"
+ DataTextField="title"
+ DataNavigateUrlField="ISBN"
+ DataNavigateUrlFormatString="http://www.amazon.com/gp/product/%s"
+ Target="_blank"
+ />
+ <com:TActiveBoundColumn
+ SortExpression="publisher"
+ HeaderText="Publisher"
+ DataField="publisher"
+ />
+ <com:TActiveBoundColumn
+ SortExpression="price"
+ ItemStyle.HorizontalAlign="Right"
+ ItemStyle.Wrap="false"
+ ItemStyle.Font.Italic="false"
+ ItemStyle.ForeColor="green"
+ HeaderText="Price"
+ DataField="price"
+ DataFormatString="$%.2f"
+ />
+ <com:TActiveCheckBoxColumn
+ SortExpression="instock"
+ HeaderText="In-stock"
+ HeaderStyle.Wrap="false"
+ DataField="instock"
+ />
+ <com:TActiveTemplateColumn HeaderText="Rating" SortExpression="rating">
+ <prop:ItemTemplate>
+ <img src="images/star<%#$this->NamingContainer->DataItem['rating']%>.gif" alt="" />
+ </prop:ItemTemplate>
+ </com:TActiveTemplateColumn>
+</com:TActiveDataGrid>
+
+<div class="last-modified">$Id$</div></com:TContent> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample4.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample4.php
new file mode 100644
index 00000000..eb1a0e5b
--- /dev/null
+++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample4.php
@@ -0,0 +1,21 @@
+<?php
+
+Prado::using('Application.pages.ActiveControls.Samples.TActiveDataGrid.Sample2');
+
+class Sample4 extends Sample2
+{
+ protected function sortData($data,$key)
+ {
+ $compare = create_function('$a,$b','if ($a["'.$key.'"] == $b["'.$key.'"]) {return 0;}else {return ($a["'.$key.'"] > $b["'.$key.'"]) ? 1 : -1;}');
+ usort($data,$compare) ;
+ return $data ;
+ }
+
+ public function sortDataGrid($sender,$param)
+ {
+ $this->DataGrid->DataSource=$this->sortData($this->Data,$param->SortExpression);
+ $this->DataGrid->dataBind();
+ }
+}
+
+?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample5.page b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample5.page
new file mode 100644
index 00000000..86968e48
--- /dev/null
+++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample5.page
@@ -0,0 +1,25 @@
+<com:TContent ID="body">
+
+<h1>TActiveDataGrid Sample 5</h1>
+<h2>Paging</h2>
+
+<div style="width:500px">
+<com:TActiveDataGrid
+ ID="DataGrid"
+ AllowPaging="true"
+ PageSize="5"
+ PagerStyle.Mode="Numeric"
+ PagerStyle.HorizontalAlign="Right"
+ Width="100%"
+ CellPadding="2"
+ HeaderStyle.BackColor="black"
+ HeaderStyle.ForeColor="white"
+ ItemStyle.BackColor="#BFCFFF"
+ ItemStyle.Font.Italic="true"
+ AlternatingItemStyle.BackColor="#E6ECFF"
+ OnPageIndexChanged="changePage"
+ OnPagerCreated="pagerCreated"
+ />
+</div>
+
+<div class="last-modified">$Id$</div></com:TContent> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample5.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample5.php
new file mode 100644
index 00000000..95bf9a0e
--- /dev/null
+++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample5.php
@@ -0,0 +1,79 @@
+<?php
+
+Prado::using('Application.pages.ActiveControls.Samples.TActiveDataGrid.Sample1');
+
+class Sample5 extends Sample1
+{
+
+ public function onLoad($param)
+ {
+ parent::onLoad($param);
+ if(!$this->IsPostback && ! $this->IsCallback)
+ {
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+ }
+
+ public function changePage($sender,$param)
+ {
+ $this->DataGrid->CurrentPageIndex=$param->NewPageIndex;
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+
+ public function pagerCreated($sender,$param)
+ {
+ $param->Pager->Controls->insertAt(0,'Page: ');
+ }
+
+ public function changePagerPosition($sender,$param)
+ {
+ $top=$sender->Items[0]->Selected;
+ $bottom=$sender->Items[1]->Selected;
+ if($top && $bottom)
+ $position='TopAndBottom';
+ else if($top)
+ $position='Top';
+ else if($bottom)
+ $position='Bottom';
+ else
+ $position='';
+ if($position==='')
+ $this->DataGrid->PagerStyle->Visible=false;
+ else
+ {
+ $this->DataGrid->PagerStyle->Position=$position;
+ $this->DataGrid->PagerStyle->Visible=true;
+ }
+ }
+
+ public function useNumericPager($sender,$param)
+ {
+ $this->DataGrid->PagerStyle->Mode='Numeric';
+ $this->DataGrid->PagerStyle->NextPageText=$this->NextPageText->Text;
+ $this->DataGrid->PagerStyle->PrevPageText=$this->PrevPageText->Text;
+ $this->DataGrid->PagerStyle->PageButtonCount=$this->PageButtonCount->Text;
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+
+ public function useNextPrevPager($sender,$param)
+ {
+ $this->DataGrid->PagerStyle->Mode='NextPrev';
+ $this->DataGrid->PagerStyle->NextPageText=$this->NextPageText->Text;
+ $this->DataGrid->PagerStyle->PrevPageText=$this->PrevPageText->Text;
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+
+ public function changePageSize($sender,$param)
+ {
+ $this->DataGrid->PageSize=TPropertyValue::ensureInteger($this->PageSize->Text);
+ $this->DataGrid->CurrentPageIndex=0;
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+}
+
+?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataList/Home.page b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataList/Home.page
new file mode 100644
index 00000000..ebd88424
--- /dev/null
+++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataList/Home.page
@@ -0,0 +1,125 @@
+<com:TContent ID="body">
+
+<h1>TActiveDataList Sample</h1>
+
+<com:TActiveDataList
+ ID="DataList"
+ DataKeyField="id"
+ OnEditCommand="editItem"
+ OnCancelCommand="cancelItem"
+ OnUpdateCommand="updateItem"
+ OnDeleteCommand="deleteItem"
+ OnSelectedIndexChanged="selectItem"
+ HeaderStyle.BackColor="black"
+ HeaderStyle.ForeColor="white"
+ ItemStyle.BackColor="#BFCFFF"
+ AlternatingItemStyle.BackColor="#E6ECFF"
+ EditItemStyle.BackColor="lightgreen"
+ SelectedItemStyle.BackColor="lightyellow">
+
+<prop:HeaderTemplate>
+<div style="font-weight:bold; text-align:center;">Computer Parts</div>
+</prop:HeaderTemplate>
+
+<prop:ItemTemplate>
+<table border="0" width="100%">
+<tr>
+ <td>
+ <com:TActiveLinkButton
+ Text=<%#$this->DataItem['id']%>
+ CommandName="select"
+ />
+ <%#$this->DataItem['name']%>
+ </td>
+ <td align="right">
+ <com:TActiveLinkButton
+ Text="Edit"
+ CommandName="edit"
+ />
+ <com:TActiveLinkButton
+ Text="Delete"
+ CommandName="delete"
+ Attributes.onclick="if(!confirm('Are you sure?')) return false;"
+ />
+ </td>
+</tr>
+</table>
+</prop:ItemTemplate>
+
+<prop:SelectedItemTemplate>
+<table border="1" width="100%">
+<tr>
+ <th>ID</th><th>Name</th><th>Quantity</th><th>Price</th>
+</tr>
+<tr>
+ <td align="right"><%#$this->DataItem['id'] %></td>
+ <td align="right"><%#$this->DataItem['name'] %></td>
+ <td align="right"><%#$this->DataItem['quantity'] %></td>
+ <td align="right">$<%#$this->DataItem['price'] %></td>
+</tr>
+<tr>
+ <td colspan="4" align="right">
+ <com:TActiveLinkButton
+ Text="Edit"
+ CommandName="edit"
+ />
+ <com:TActiveLinkButton
+ Text="Delete"
+ CommandName="delete"
+ Attributes.onclick="if(!confirm('Are you sure?')) return false;"
+ />
+ </td>
+</tr>
+</table>
+</prop:SelectedItemTemplate>
+
+<prop:EditItemTemplate>
+<table border="0" width="100%">
+<tr>
+ <td align="right">ID</td>
+ <td><b><%#$this->DataItem['id']%></b></td>
+</tr>
+<tr>
+ <td align="right">Name</td>
+ <td><com:TTextBox
+ ID="ProductName"
+ Text=<%#$this->DataItem['name'] %>
+ />
+ </td>
+</tr>
+<tr>
+ <td align="right">Quantity</td>
+ <td><com:TTextBox
+ ID="ProductQuantity"
+ Text=<%#$this->DataItem['quantity'] %>
+ />
+ </td>
+</tr>
+<tr>
+ <td align="right">Price</td>
+ <td><com:TTextBox
+ ID="ProductPrice"
+ Text=<%#$this->DataItem['price'] %>
+ />
+ </td>
+</tr>
+<tr>
+ <td align="right">Imported</td>
+ <td><com:TCheckBox
+ ID="ProductImported"
+ Checked=<%#$this->DataItem['imported'] %>
+ />
+ </td>
+</tr>
+<tr>
+ <td colspan="2" align="right">
+ <com:TActiveLinkButton Text="Save" CommandName="update" />
+ <com:TActiveLinkButton Text="Cancel" CommandName="cancel" />
+ </td>
+</tr>
+</table>
+</prop:EditItemTemplate>
+
+</com:TActiveDataList>
+
+<div class="last-modified">$Id$</div></com:TContent> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataList/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataList/Home.php
new file mode 100644
index 00000000..c62a239d
--- /dev/null
+++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataList/Home.php
@@ -0,0 +1,132 @@
+<?php
+
+class Home extends TPage
+{
+ private $_data=null;
+
+ protected function getData()
+ {
+ if($this->_data===null)
+ $this->loadData();
+ return $this->_data;
+ }
+
+ protected function loadData()
+ {
+ // We use viewstate keep track of data.
+ // In real applications, data should come from database using an SQL SELECT statement.
+ // In the following tabular data, field 'id' is the primary key.
+ // All update and delete operations should come with an 'id' value in order to go through.
+ if(($this->_data=$this->getViewState('Data',null))===null)
+ {
+ $this->_data=array(
+ 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'=>false),
+ 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'=>true),
+ array('id'=>'ITN007','name'=>'Monitor','quantity'=>2,'price'=>300.00,'imported'=>false),
+ );
+ $this->saveData();
+ }
+ }
+
+ protected function saveData()
+ {
+ $this->setViewState('Data',$this->_data);
+ }
+
+ protected function updateProduct($id,$name,$quantity,$price,$imported)
+ {
+ // In real applications, data should be saved to database using an SQL UPDATE statement
+ if($this->_data===null)
+ $this->loadData();
+ $updateRow=null;
+ foreach($this->_data as $index=>$row)
+ if($row['id']===$id)
+ $updateRow=&$this->_data[$index];
+ if($updateRow!==null)
+ {
+ $updateRow['name']=$name;
+ $updateRow['quantity']=TPropertyValue::ensureInteger($quantity);
+ $updateRow['price']=TPropertyValue::ensureFloat($price);
+ $updateRow['imported']=TPropertyValue::ensureBoolean($imported);
+ $this->saveData();
+ }
+ }
+
+ protected function deleteProduct($id)
+ {
+ // In real applications, data should be saved to database using an SQL DELETE statement
+ if($this->_data===null)
+ $this->loadData();
+ $deleteIndex=-1;
+ foreach($this->_data as $index=>$row)
+ if($row['id']===$id)
+ $deleteIndex=$index;
+ if($deleteIndex>=0)
+ {
+ unset($this->_data[$deleteIndex]);
+ $this->saveData();
+ }
+ }
+
+ public function onLoad($param)
+ {
+ parent::onLoad($param);
+ if(!$this->IsPostBack)
+ {
+ $this->DataList->DataSource=$this->Data;
+ $this->DataList->dataBind();
+ }
+ }
+
+ public function editItem($sender,$param)
+ {
+ $this->DataList->SelectedItemIndex=-1;
+ $this->DataList->EditItemIndex=$param->Item->ItemIndex;
+ $this->DataList->DataSource=$this->Data;
+ $this->DataList->dataBind();
+ }
+
+ public function cancelItem($sender,$param)
+ {
+ $this->DataList->SelectedItemIndex=-1;
+ $this->DataList->EditItemIndex=-1;
+ $this->DataList->DataSource=$this->Data;
+ $this->DataList->dataBind();
+ }
+
+ public function updateItem($sender,$param)
+ {
+ $item=$param->Item;
+ $this->updateProduct(
+ $this->DataList->DataKeys[$item->ItemIndex],
+ $item->ProductName->Text,
+ $item->ProductQuantity->Text,
+ $item->ProductPrice->Text,
+ $item->ProductImported->Checked);
+ $this->DataList->EditItemIndex=-1;
+ $this->DataList->DataSource=$this->Data;
+ $this->DataList->dataBind();
+ }
+
+ public function deleteItem($sender,$param)
+ {
+ $this->deleteProduct($this->DataList->DataKeys[$param->Item->ItemIndex]);
+ $this->DataList->SelectedItemIndex=-1;
+ $this->DataList->EditItemIndex=-1;
+ $this->DataList->DataSource=$this->Data;
+ $this->DataList->dataBind();
+ }
+
+ public function selectItem($sender,$param)
+ {
+ $this->DataList->EditItemIndex=-1;
+ $this->DataList->DataSource=$this->Data;
+ $this->DataList->dataBind();
+ }
+}
+
+?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/Home.page b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/Home.page
new file mode 100644
index 00000000..4d855cbc
--- /dev/null
+++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/Home.page
@@ -0,0 +1,92 @@
+<com:TContent ID="body">
+
+<h1>TActiveRepeater Sample</h1>
+
+<p>
+The following example allows users to modify the existing tabular data using a <tt>TActiveRepeater</tt>. Two validators are used in the repeater to ensure the validity of user inputs. One is to ensure product names are not empty, the other ensures product prices are valid numeric format. After clicking on the <tt>save</tt> button, the input data is displayed in a table at the bottom of the page.
+</p>
+
+<table>
+<tr>
+ <th>Name</th>
+ <th>Category</th>
+ <th>Price</th>
+ <th>Imported</th>
+</tr>
+<com:TActiveRepeater ID="Repeater" OnItemDataBound="repeaterDataBound">
+<prop:ItemTemplate>
+<tr>
+ <td>
+ <com:TTextBox
+ ID="ProductName"
+ Text=<%#$this->Data['name']%> />
+ </td>
+ <td>
+ <com:TDropDownList
+ ID="ProductCategory" />
+ </td>
+ <td>
+ <com:TTextBox
+ ID="ProductPrice"
+ Columns="7"
+ Text=<%#$this->Data['price']%> />
+ </td>
+ <td>
+ <com:TCheckBox
+ ID="ProductImported"
+ Checked=<%#$this->Data['imported']%> />
+ <com:TRequiredFieldValidator
+ ControlToValidate="ProductName"
+ ErrorMessage="Product name cannot be empty."
+ Display="Dynamic" />
+ <com:TRegularExpressionValidator
+ ControlToValidate="ProductPrice"
+ RegularExpression="\d+(\.\d{1,2})?"
+ ErrorMessage="Product price must be in the format of ddd.dd"
+ Display="Dynamic" />
+ </td>
+</tr>
+</prop:ItemTemplate>
+</com:TActiveRepeater>
+</table>
+
+<div>
+<com:TActiveButton Text="Save" OnClick="saveInput"/>
+</div>
+
+<com:TSafeHtml>
+<com:TActiveRepeater ID="Repeater2" EnableViewState="false">
+
+<prop:HeaderTemplate>
+<table cellpadding="2">
+<tr style="color:white;background-color:black">
+ <th>ID</th>
+ <th>Name</th>
+ <th>Category</th>
+ <th>Price</th>
+ <th>Imported</th>
+</tr>
+</prop:HeaderTemplate>
+
+<prop:ItemTemplate>
+<tr style="<%# 'background-color:' . ($this->ItemIndex%2 ? '#BFCFFF' : '#E6ECFF') %>">
+<td><%#$this->Data['id']%></td>
+<td><%#$this->Data['name']%></td>
+<td><%#$this->Data['category']%></td>
+<td><%#$this->Data['price']%></td>
+<td><%#$this->Data['imported']?'Yes':'No'%></td>
+</tr>
+</prop:ItemTemplate>
+
+<prop:FooterTemplate>
+<tr style="color:white;background-color:black;text-align:center;">
+<td colspan="5">Computer Parts Inventory</td>
+</tr>
+</table>
+</prop:FooterTemplate>
+
+</com:TActiveRepeater>
+
+</com:TSafeHtml>
+
+<div class="last-modified">$Id: Sample3.page 1688 2007-02-09 22:48:31Z xue $</div></com:TContent> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/Home.php
new file mode 100644
index 00000000..f7c8d61c
--- /dev/null
+++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/Home.php
@@ -0,0 +1,79 @@
+<?php
+
+class Home extends TPage
+{
+ protected function getProducts()
+ {
+ return array(
+ array('id'=>'ITN001','name'=>'Motherboard','category'=>'CAT004','price'=>100.00,'imported'=>true),
+ array('id'=>'ITN002','name'=>'CPU','category'=>'CAT004','price'=>150.00,'imported'=>true),
+ array('id'=>'ITN003','name'=>'Harddrive','category'=>'CAT003','price'=>80.00,'imported'=>true),
+ array('id'=>'ITN006','name'=>'Keyboard','category'=>'CAT002','price'=>20.00,'imported'=>false),
+ array('id'=>'ITN008','name'=>'CDRW drive','category'=>'CAT003','price'=>40.00,'imported'=>true),
+ array('id'=>'ITN009','name'=>'Cooling fan','category'=>'CAT001','price'=>10.00,'imported'=>false),
+ array('id'=>'ITN012','name'=>'Floppy drive','category'=>'CAT003','price'=>12.00,'imported'=>false),
+ array('id'=>'ITN013','name'=>'CD drive','category'=>'CAT003','price'=>20.00,'imported'=>true),
+ array('id'=>'ITN014','name'=>'DVD drive','category'=>'CAT003','price'=>80.00,'imported'=>true),
+ array('id'=>'ITN015','name'=>'Mouse pad','category'=>'CAT001','price'=>5.00,'imported'=>false),
+ );
+ }
+
+ protected function getCategories()
+ {
+ return array(
+ array('id'=>'CAT001','name'=>'Accessories'),
+ array('id'=>'CAT002','name'=>'Input Devices'),
+ array('id'=>'CAT003','name'=>'Drives'),
+ array('id'=>'CAT004','name'=>'Barebone'),
+ );
+ }
+
+ public function onLoad($param)
+ {
+ parent::onLoad($param);
+ if(!$this->IsPostBack)
+ {
+ $this->Repeater->DataSource=$this->Products;
+ $this->Repeater->dataBind();
+ }
+ }
+
+ public function repeaterDataBound($sender,$param)
+ {
+ $item=$param->Item;
+ if($item->ItemType==='Item' || $item->ItemType==='AlternatingItem')
+ {
+ $item->ProductCategory->DataSource=$this->Categories;
+ $item->ProductCategory->DataTextField='name';
+ $item->ProductCategory->DataValueField='id';
+ $item->ProductCategory->dataBind();
+ $item->ProductCategory->SelectedValue=$item->DataItem['category'];
+ }
+ }
+
+ public function saveInput($sender,$param)
+ {
+ if($this->IsValid)
+ {
+ $index=0;
+ $products=$this->Products;
+ $data=array();
+ foreach($this->Repeater->Items as $item)
+ {
+ $item=array(
+ 'id'=>$products[$index]['id'],
+ 'name'=>$item->ProductName->Text,
+ 'category'=>$item->ProductCategory->SelectedItem->Text,
+ 'price'=>TPropertyValue::ensureFloat($item->ProductPrice->Text),
+ 'imported'=>$item->ProductImported->Checked,
+ );
+ $data[]=$item;
+ $index++;
+ }
+ $this->Repeater2->DataSource=$data;
+ $this->Repeater2->dataBind();
+ }
+ }
+}
+
+?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/DataGrid.page b/demos/quickstart/protected/pages/Controls/DataGrid.page
index bc700449..85a53011 100644
--- a/demos/quickstart/protected/pages/Controls/DataGrid.page
+++ b/demos/quickstart/protected/pages/Controls/DataGrid.page
@@ -1,6 +1,7 @@
<com:TContent ID="body" >
<h1 id="5201">TDataGrid</h1>
+<com:DocLink ClassPath="System.Web.UI.WebControls.TDataGrid" />
<p id="590373" class="block-content">
TDatagrid is an important control in building complex Web applications. It displays data in a tabular format with rows (also called items) and columns. A row is composed by cells, while columns govern how cells should be displayed according to their association with the columns. Data specified via <tt>DataSource</tt> or <tt>DataSourceID</tt> are bound to the rows and feed contents to cells.
@@ -17,7 +18,7 @@ Rows of TDataGrid can be accessed via its <tt>Items</tt> property. A row (item)
Columns of a data grid determine how the associated cells are displayed. For example, cells associated with a <tt>TBoundColumn</tt> are displayed differently according to their modes. A cell is displayed as a static text if the cell is in browsing mode, a text box if it is in editing mode, and so on.
</p>
<p id="590377" class="block-content">
-PRADO provides five types of columns:
+PRADO provides eight types of columns:
</p>
<ul id="u1" class="block-content">
<li><tt>TBoundColumn</tt> associates cells with a specific field of data and displays the cells according to their modes.</li>
diff --git a/demos/quickstart/protected/pages/Controls/DataList.page b/demos/quickstart/protected/pages/Controls/DataList.page
index d92aa69c..14197f35 100644
--- a/demos/quickstart/protected/pages/Controls/DataList.page
+++ b/demos/quickstart/protected/pages/Controls/DataList.page
@@ -1,6 +1,8 @@
<com:TContent ID="body" >
<h1 id="5101">TDataList</h1>
+<com:DocLink ClassPath="System.Web.UI.WebControls.TDataList" />
+
<p id="580362" class="block-content">
TDataList represents a data bound and updatable list control. Like <tt>TRepeater</tt>, TDataList displays its content repeatedly based on the data fetched from <tt>DataSource</tt>. The repeated contents in TDataList are called items, which are controls and can be accessed through <tt>Items</tt>. When <tt>dataBind()</tt> is invoked, TDataList creates an item for each row of data and binds the data row to the item. Optionally, a TDataList can have a header, a footer and/or separators between items.
</p>
diff --git a/demos/quickstart/protected/pages/Controls/Repeater.page b/demos/quickstart/protected/pages/Controls/Repeater.page
index 1e2ac881..459f8767 100644
--- a/demos/quickstart/protected/pages/Controls/Repeater.page
+++ b/demos/quickstart/protected/pages/Controls/Repeater.page
@@ -1,6 +1,7 @@
<com:TContent ID="body" >
<h1 id="5301">TRepeater</h1>
+<com:DocLink ClassPath="System.Web.UI.WebControls.TRepeater" />
<p id="600400" class="block-content">
TRepeater displays its content repeatedly based on the data fetched from <tt>DataSource</tt>. The repeated contents in TRepeater are called <i>items</i> which are controls accessible through <tt>Items</tt> property. When <tt>dataBind()</tt> is invoked, TRepeater creates an item for each row of data and binds the data row to the item. Optionally, a repeater can have a header, a footer and/or separators between items.