views:

35

answers:

0

I'm using a gridview where I list the articles on the page that the current logged in user has added to his/hers list of favorites. Next to the list I'd like to have a image of an X to delete the article from the list. However, I can't figure out how to get the ID of the article (so that I know what ID to delete from the SQL table) when I'm not displaying the ID in the actual listing. There's only a list of links generated from the pageID of the actual page that has been added to the list of favorites.

        <asp:GridView ID="gvArticles" CssClass="GridsFavorite" runat="server" AllowPaging="True"
            AutoGenerateColumns="False" onpageindexchanging="gvArticles_PageIndexChanging" 
            onrowdeleting="gvArticles_RowDeleting" PageSize="5" BorderStyle="None" RowStyle-BorderStyle="None" GridLines="None">
            <Columns>
                <asp:TemplateField>
                    <ItemTemplate>
                        <%# GetLinks(Convert.ToInt32(Eval("PageID"))) %>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:CommandField ShowDeleteButton="true" ButtonType="Link" DeleteText="x" />
            </Columns>
        </asp:GridView>

I haven't gotten anywhere with the code behind for the gvArticles_RowDeleting so far since I don't know how to get the PageID out of there without having to put them out there.