Deleting an entry from your "Recent Updates" List

Stage 2: Delete its big fat ass

We now need to create a the workings of our delete page. This page needs to do a number of things:

  1. Create a recordset based on the output of the previous page (the "id" parameter on the query string)
  2. Display the selected record for visual confirmation
  3. Provide a Big Red Button to delete the item.

(This button is only Big and Red in the loosest senses of the words ... it's actually going to be small and grey, but a Small Grey Button holds less glamour, so Big and Red it is).

Open up the delete page, and we'll define a Recordset like we did before.

The important thing about this recordset is that it uses a filter. The filter as shown above is based on the newsID field. The recordset is going to be filled with any records where the newsID field matches the id parameter passed through to the page on the query string. As newsID is always unique in the database, we should only get one record in our recordset.

We now need to insert the results as text into the page - to serve as a visual confirmation of the record which is to be deleted. I'm hoping you know how to do this by now - we covered it in the first tutorial of this section.

OK, so we've found our record, we've displayed it to confirm that it's what there user was looking for, now all we need is that Big Red Button.

Create a form at the bottom of the page.

We're now going to apply the Delete Record Server Behavior to do the dirty deed.

You should hopefully be presented with a dialog box a lot like this one

Select your Connection, the appropriate Table and check that all the other items are as you'd expect them.
Finally, select a URL to redirect to after the execution.

Save your page, and try viewing your initial 'search' page in a browser

And the result ....

Then after clicking the button ...

Our entry has been removed from the database, and so no longer exists at the top of the list!

Time for another pat on the back!

Return to the index »