| |||||
DataList.EditItemTemplate PropertySystem.Web.UI.WebControls Namespace DataList Class Specifies the template to use for the item to edit in a DataList. Syntax<asp:datalist ... >
<edititemtemplate>
... template definition here
</edititemtemplate>
</asp:datalist>
Property ValueAn ITemplate interface that defines how the item selected for editing in the DataList control is rendered. The property is read/write with no default value. RemarksUse the EditItemTemplate to define the appearance of the item selected for editing in a DataList control. The EditItemTemplate functions in the same way as the ItemTemplate, but rendered only for the row selected for editing in the DataList control. You can set the appearance for the item in this template using the EditItemStyle property. To specify a template for the item to edit in a DataList, declare an <EditItemTemplate> element between the opening and closing tags of the control. You can then list the contents of the template between the opening and closing The item in the EditItemTemplate is data-bound. To display data in the EditItemTemplate, declare one or more Web server controls and set their data-binding expressions to evaluate to a field in the DataList control's DataSource. Contact: <asp:textbox id = "contact" runat = "server" text='<%# ( ( DataRowView ) Container.DataItem ) [ "ContactName" ] %>' /> For more information, see DataBinding Expression Syntax. ExampleThe following example illustrates using the EditItemTemplate to display the item to edit in a DataList in a different layout and format. <asp:datalist ...
edititemstyle-backcolor = "lightsteelblue">
<itemtemplate>
... template definition here
</itemtemplate>
<edititemtemplate>
<table ... >
...
<tr>
<td>Contact: </td>
<td><asp:textbox id = "contact" runat = "server"
text='<%# ( ( DataRowView ) Container.DataItem ) [ "ContactName" ] %>' /></td>
</tr>
...
<tr align = "center">
<td colspan=2>
<asp:linkbutton commandname = "update" runat = "server" text = "Update" />
<asp:linkbutton commandname = "cancel" runat = "server" text = "Cancel" />
</td>
</tr>
</table>
</edititemtemplate>
</asp:datalist>
See AlsoDataList Members EditItemIndex EditItemStyle Allowing Users to Edit Items in a DataList Control |
| ||||
Check out related books at Amazon
© 2000-2008 Rey Nuñez All rights reserved.
If you have any question, comment or suggestion
about this site, please send us a note
You can help support aspxtreme