summaryrefslogtreecommitdiff
path: root/demos/quickstart/protected/pages/Controls/Samples/TDataList/Sample2.page
blob: 018aabfd44b7160e14a9214e0f26244acdd175db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<com:TContent ID="body">

<h1>TDataList Sample 2</h1>
<p>This demo shows a simple application of TDataList control.</p>
<p>TDataList allows you to show a list of data items (rows), edit, select and delete them.</p>

<com:TDataList ID="DataList"
			CellPadding="2"
			CellSpacing="3"
			GridLines="Both"
			RepeatColumns="1"
			RepeatLayout="Table"
			RepeatDirection="Vertical"
			OnEditCommand="editItem"
			OnCancelCommand="cancelItem"
			OnUpdateCommand="updateItem"
			OnDeleteCommand="deleteItem"
			OnSelectedIndexChanged="selectItem"
			HeaderStyle.BackColor="#AAAADD"
			ItemStyle.BackColor="#EEEEEE"
			SeparatorStyle.BackColor="#FAFAFA"
			FooterStyle.BackColor="#BBBBBB"
			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:TLinkButton
     Text=<%#$this->Parent->DataItem['id']%>
     CommandName="select"
     />
<%#$this->Parent->DataItem['name']%>
</td>
<td align="right">
<com:TLinkButton
     Text="Edit"
     CommandName="edit"
     />
<com:TLinkButton
     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->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>
<tr><td colspan="4" align="right">
<com:TLinkButton
     Text="Edit"
     CommandName="edit"
     />
<com:TLinkButton
     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><%#$this->Parent->DataItem['id']%></td>
</tr>
<tr>
  <td align="right">Name</td>
  <td><com:TTextBox
           ID="ProductName"
           Text=<%#$this->Parent->DataItem['name'] %>
           />
  </td>
</tr>
<tr>
  <td align="right">Quantity</td>
  <td><com:TTextBox
           ID="ProductQuantity"
           Text=<%#$this->Parent->DataItem['quantity'] %>
           />
  </td>
</tr>
<tr>
  <td align="right">Price</td>
  <td><com:TTextBox
           ID="ProductPrice"
           Text=<%#$this->Parent->DataItem['price'] %>
           />
  </td>
</tr>
<tr>
  <td colspan="2" align="right">
    <com:TLinkButton Text="Save" CommandName="update" />
    <com:TLinkButton Text="Cancel" CommandName="cancel" />
  </td>
</tr>
</table>
</prop:EditItemTemplate>

</com:TDataList>

</com:TContent>