Hi Imar, thanks for the reply.
The code behind file is basically the code in my previous post (just missing the add new content button code). Markup for the rest of the page is:
<%@ Page Language="
VB" MasterPageFile="~/AdminMaster.master" AutoEventWireup="false" CodeFile="ContentList.aspx.
vb" Inherits="ContentList" Title="Manage Content" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContentPlaceholder" runat="Server">
<h1>Content List</h1>
Below you find a list of all the content published on this site. Use the drop-down to view either active or deleted content items. Click the Create New button to create a new content item.
<br />
<br />
<span class="ScreenTip">Show all</span>
<asp:DropDownList ID="lstStatus" runat="server" AutoPostBack="True">
<asp:ListItem Value="1">Active</asp:ListItem>
<asp:ListItem Value="0">Deleted</asp:ListItem>
</asp:DropDownList>
<span class="ScreenTip">content items</span>
<p>
<asp:GridView ID="gvContent" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="Id" DataSourceID="sdsContent" Width="720px">
<Columns>
<asp:BoundField DataField="Id" HeaderText="ID" InsertVisible="False" ReadOnly="True" SortExpression="Id" Visible="False" />
<asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title">
<ItemStyle Width="250px" />
</asp:BoundField>
<asp:BoundField DataField="ContentTypeDescription" HeaderText="Content Type" SortExpression="ContentTypeDescription">
<ItemStyle Width="125px" />
</asp:BoundField>
<asp:BoundField DataField="CategoryDescription" HeaderText="Category" SortExpression="CategoryDescription">
<ItemStyle Width="175px" />
</asp:BoundField>
<asp:ButtonField ButtonType="Button" CommandName="Edit" Text="Edit">
<ItemStyle Width="75px" />
</asp:ButtonField>
<asp:TemplateField ShowHeader="False">
<ItemStyle Width="75px" />
<ItemTemplate>
<asp:Button ID="Button1" CommandArgument='<%#Eval("Id")%>' runat="server" CausesValidation="False"
CommandName="Delete" Text="Delete" OnClientClick="return confirm('Are you sure you want to delete this item?');" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</p>
<br />
<asp:Button ID="btnNew" runat="server" Text="Create New" /><br />
<asp:SqlDataSource ID="sdsContent" runat="server" ConnectionString="<%$ ConnectionStrings:Cms %>"
SelectCommand="sprocContentSelectList" SelectCommandType="StoredProcedure" DeleteCommandType="StoredProcedure" DeleteCommand="sprocContentDeleteSingleItem">
<SelectParameters>
<asp:ControlParameter ControlID="lstStatus" Name="visible" PropertyName="SelectedValue" Type="Int32" />
</SelectParameters>
<DeleteParameters>
<asp:Parameter Name="id" Type="Int32" />
</DeleteParameters>
</asp:SqlDataSource>
</asp:Content>
The Content class doesn't appear to have a delete method (like the Customer Support Product Class) - presumably because the records aren't technically deleted. By clicking the button and using the "GetItem(Integer) as Content" method, is the content record ID not being passed to the stored procedure - if not, I don't understand why it works??
Rather than sending the default recordid should the following lines be added (as per the edit select statement)?
recordIndex = Convert.ToInt32(e.CommandArgument)
recordId = Convert.ToInt32(gvContent.DataKeys(recordIndex).Va lue)
Content.GetItem(recordId)
gvContent.DataBind()
Many thanks