Currently I have a page that will display all details about a person in the database, and allow the user to edit them. These details are populated in the form of several different ListViews, with different ItemTemplates, like so:

         <asp:ListView ID="lvAddress" runat="server">
            <ItemTemplate>
                <tr>
                    <td><b>Address:</b></td>
                    <td>
                        <asp:Textbox ID="txtAddress" runat="server" Text='<%# Eval("[Address]") %>' /><br />
                        <asp:Textbox ID="txtCity" runat="server" Text='<%# Eval("City") %>' /><br />
                        <asp:Textbox ID="txtState" runat="server" Text='<%# Eval("[State]") %>' /><br />
                        <asp:Textbox ID="txtZip" runat="server" Text='<%# Eval("[ZipCode]") %>' /><br />     
                    </td>
                </tr>
            </ItemTemplate>
        </asp:ListView>
        <tr>
            <td colspan="2"><asp:LinkButton ID="lnkAddAddress" runat="server">Add New Address</asp:LinkButton></td>
        </tr>

I have a button below each of these ListViews, where, when clicked, is supposed to dynamically generate another entry that looks like the ItemTemplate above (except naturally, the textboxes will be empty since you are adding a new entry, not evaluating an existing one.) Hopefully you can now see what I am trying to accomplish here. The code in question doesn't have to necessarily use the ItemTemplate itself, so long as the result is similar and I have some way to retrieve the information to add it to a DB later on.

Any help on this subject would be greatly appreciated, I know how to delete specific rows, but I am at a loss on how to add new ones!

Related posts

Recent Viewed