/Controls/Samples/TDataList/Sample2.page
<com:TContent ID="body">
<h1>TDataList Sample 2</h1>
<com:TDataList
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:TLinkButton
Text=<%#$this->Data['id']%>
CommandName="select"
/>
<%#$this->Data['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->Data['id'] %></td>
<td align="right"><%#$this->Data['name'] %></td>
<td align="right"><%#$this->Data['quantity'] %></td>
<td align="right">$<%#$this->Data['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><b><%#$this->Data['id']%></b></td>
</tr>
<tr>
<td align="right">Name</td>
<td><com:TTextBox
ID="ProductName"
Text=<%#$this->Data['name'] %>
/>
</td>
</tr>
<tr>
<td align="right">Quantity</td>
<td><com:TTextBox
ID="ProductQuantity"
Text=<%#$this->Data['quantity'] %>
/>
</td>
</tr>
<tr>
<td align="right">Price</td>
<td><com:TTextBox
ID="ProductPrice"
Text=<%#$this->Data['price'] %>
/>
</td>
</tr>
<tr>
<td align="right">Imported</td>
<td><com:TCheckBox
ID="ProductImported"
Checked=<%#$this->Data['imported'] %>
/>
</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>