<asp:ListView ID="lvwTemplates" runat="server"
InsertItemPosition="FirstItem"
OnItemCommand="lvwTemplates_OnItemCommand"
OnItemCanceling="lvwTemplates_OnItemCanceling"
OnItemEditing="lvwTemplates_OnItemEditing"
OnItemInserted="lvwTemplates_OnItemInserted"
OnItemInserting="lvwTemplates_OnItemInserting"
OnItemDeleting="lvwTemplates_OnItemDeleting"
OnItemUpdating="lvwTemplates_OnItemUpdating"
<LayoutTemplate>
<div>
<table>
<tr>
<td><asp:Button ID="btnNewTemplate"
runat="server" Text="New Template" OnClick="btnNewTemplate"
CausesValidation="false" /></td>
<td><asp:Button ID="btnBulkEdit"
runat="server" Text="Bulk Edit" OnClick="btnBulkEdit"
CausesValidation="false" /></td>
</tr>
</table>
<div id="elementViewer">
<asp
laceHolder ID="itemContainer"
runat="server" />
</div>
</div>
</LayoutTemplate>
<ItemTemplate>
<table width="400px">
<tr>
<td width="325px">
<asp:Label ID="lblTemplateID" runat="server"
Text="<%#((Bullsh1tTemplate)Container.DataItem).TemplateID %>"
Visible="false" />
<asp:Literal ID="ltrTemplate" runat="server"
Text="<%#((Bullsh1tTemplate)Container.DataItem).TemplateBody %>" />
</td>
<td><asp:Button ID="btnEdit" runat="server"
CommandName="edit" Text="Edit"/></td>
<td><asp:Button ID="btnDelete" runat="server"
CommandName="delete" Text="Delete" /></td>
</tr>
</table>
</ItemTemplate>
<EditItemTemplate>
<gaia:Label ID="lblTemplateID" runat="server" Text="<
%#((Bullsh1tTemplate)Container.DataItem).TemplateID %>"
Visible="false" />
<table width="400px">
<tr>
<td width="325px">
<asp:TextBox ID="tbxTemplate" runat="server"
Text="<%#((Bullsh1tTemplate)Container.DataItem).TemplateBody %>" />
<asp:RequiredFieldValidator ID="rfvTemplate"
ControlToValidate="tbxTemplate" Text="required" runat="server"
Display="Dynamic" />
</td>
<td><asp:Button ID="btnUpdate" runat="server"
CommandName="update" Text="Update" /></td>
<td><asp:Button ID="btnCancel" runat="server"
CommandName="cancel" Text="Cancel" CausesValidation="false" /></td>
</tr>
</table>
</EditItemTemplate>
<InsertItemTemplate>
<table width="250px">
<tr>
<asp:RequiredFieldValidator ID="rfvTemplate"
ControlToValidate="tbxTemplate" Text="required" runat="server"
Display="Dynamic" />
</td>
<td><asp:Button ID="btnInsert" runat="server"
CommandName="insert" Text="Save" /></td>
<td><asp:Button ID="btnCancel" runat="server"
CommandName="cancel" Text="Cancel" CausesValidation="false" /></td>
</tr>
</table>
</InsertItemTemplate>
<EmptyDataTemplate>
This rule is currently empty
</EmptyDataTemplate>
</asp:ListView>
c# code
protected void lvwTemplates_OnItemEditing(object sender,
ListViewEditEventArgs e)
{
ListView listView = (ListView)sender;
TextBox tbx =
listView.FindControl("tbxTemplate")
}
In the sample above tbx gets set to null