I am showing users for my website in a listview (bound to Membership.GetAllUsers()); this is working fine. I would like to allow users to be created via the listview as well (along with some workflow driven information I'll be storing in the Profile), so I have added an InsertLayoutTemplate. However I cannot seem to read the values from the insert template in the codebehind to actually get the information to update the users table in the database. I have tried handling ItemCommand and ItemInserting and searching for the control, and this works to a point - the control is found but the Text property is always blank.
The listview declaration is similar to below.
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:ListView ID="DataLV" runat="server" DataKeyNames="UserName" InsertItemPosition="LastItem">
<ItemTemplate>
<tr style="background-color: #d0d0d0;">
<td>
<asp:Label ID="UserNameLbl" runat="server" Text='<%# Eval("UserName")%>'></asp:Label>
</td>
</tr>
</ItemTemplate>
<AlternatingItemTemplate>
<tr style="background-color: #f0f0f0;">
<td>
<asp:Label ID="UserNameLbl" runat="server" Text='<%# Eval("UserName")%>'></asp:Label>
</td>
</tr>
</AlternatingItemTemplate>
<InsertItemTemplate>
<tr style="background-color: #f0f0f0;">
<td>
<asp:TextBox ID="UserNameTB" runat="server"></asp:TextBox>
</td>
</tr>
</InsertItemTemplate>
<LayoutTemplate>
<table id="Table2" runat="server" width="100%">
<tr id="Tr1" runat="server">
<td id="Td1" runat="server">
<table id="itemPlaceholderContainer" runat="server" border="0" style="" width="100%">
<tr id="itemPlaceholder" runat="server">
</tr>
</table>
</td>
</tr>
</table>
</LayoutTemplate>
</asp:ListView>
</ContentTemplate>
</asp:UpdatePanel>