Hi Insel,
Glad you like the book. Spread the word, spread the word... ;)
Anyway, deleting an item shouldn't be too hard. Similar to how the EditCommand is used in BlogEntries.ascx, you can hook into the DeleteCommand as well, like this:
Code:
Protected Sub dlBlogEntries_DeleteCommand(ByVal source As Object, _
ByVal e As System.Web.UI.WebControls.DataListCommandEventArgs) _
Handles dlBlogEntries.DeleteCommand
' Write delete code here
End Sub
Inside this event handler, get the ID of the item being edited which you can then pass to a method like DeleteBlogEntry in the BlogManager class.
This method could look similar to GetGetBlogEntry, in that you pass a single BlogEntryId to it. Inside the method, you should fire a SQL delete statement (e.g. DELETE FROM Blog WHERE Id = @id) to delete the item.
Don't forget to delete related comments first, when you're using the comment feature.
Hope this gives you some ideas.
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of
ASP.NET 2.0 Instant Results and
Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out
this post.