listview button


This is how to add buttons to your listview:

<asp:ListView ID="MyListView" runat="server"

OnItemInserting="MyListView_ItemInserting"
OnItemEditing="MyListView_ItemEditing"
OnItemCanceling="MyListView_ItemCanceling"
OnItemUpdating="MyListView_ItemUpdating"
OnItemDeleting="MyListView_ItemDeleting"
>

<ItemTemplate>
    <tr>

<td>
    <asp:Button ID="btnDelete" runat="server" CommandName="Delete" Text="Del" Width="30px"/>
    <asp:Button ID="btnEdit" runat="server" CommandName="Edit" Text="Edit" Width="32px"/>
</td>

</tr>                               

</ItemTemplate>

<EditItemTemplate>
    <tr>

<td>
    <asp:Button ID="btnUpdate" runat="server" CommandName="Update" Text="Save" Width="30px"/>
    <asp:Button ID="btnCancel" runat="server" CommandName="Cancel" Text="Cancel" Width="32px"/>
</td>

</tr>                               

</EditItemTemplate>

<InsertItemTemplate>
    <tr>

<td>
    <asp:Button ID="btnInsert" runat="server" CommandName="Insert" Text="Add" Width="30px"/>
    <asp:Button ID="btnCancel" runat="server" CommandName="Cancel" Text="Clr" Width="32px"/>
</td>

</tr>                               

</InsertItemTemplate>

</asp:ListView>

No comments:

Post a Comment