summaryrefslogtreecommitdiff
path: root/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample3.page
diff options
context:
space:
mode:
authorxue <>2006-02-01 02:05:08 +0000
committerxue <>2006-02-01 02:05:08 +0000
commit8c659a56ca8dccd8f3a427ad3121c2296c55e9ae (patch)
tree5b3fa111242c52d93193422f89164ef4f5cc1ff3 /demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample3.page
parentbbb5ba2761529a2f477589623b2b76b10d6f8803 (diff)
Added a new repeater demo.
Diffstat (limited to 'demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample3.page')
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample3.page92
1 files changed, 92 insertions, 0 deletions
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample3.page b/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample3.page
new file mode 100644
index 00000000..115018ec
--- /dev/null
+++ b/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample3.page
@@ -0,0 +1,92 @@
+<com:TContent ID="body">
+
+<h1>TRepeater Sample 3</h1>
+
+<p>
+The following example allows users to modify the existing tabular data using a <tt>TRepeater</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:TRepeater ID="Repeater" OnItemDataBound="repeaterDataBound">
+<prop:ItemTemplate>
+<tr>
+ <td>
+ <com:TTextBox
+ ID="ProductName"
+ Text=<%#$this->Parent->DataItem['name']%> />
+ </td>
+ <td>
+ <com:TDropDownList
+ ID="ProductCategory" />
+ </td>
+ <td>
+ <com:TTextBox
+ ID="ProductPrice"
+ Columns="7"
+ Text=<%#$this->Parent->DataItem['price']%> />
+ </td>
+ <td>
+ <com:TCheckBox
+ ID="ProductImported"
+ Checked=<%#$this->Parent->DataItem['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:TRepeater>
+</table>
+
+<div>
+<com:TButton Text="Save" OnClick="saveInput"/>
+</div>
+
+<com:TSafeHtml>
+<com:TRepeater 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->Parent->ItemIndex%2 ? 'silver' : 'green') %>">
+<td><%#$this->Parent->DataItem['id']%></td>
+<td><%#$this->Parent->DataItem['name']%></td>
+<td><%#$this->Parent->DataItem['category']%></td>
+<td><%#$this->Parent->DataItem['price']%></td>
+<td><%#$this->Parent->DataItem['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:TRepeater>
+
+</com:TSafeHtml>
+
+</com:TContent> \ No newline at end of file