This topic is locked

Delete function

8/20/2009 3:56:57 PM
ASPRunnerPro General questions
L
luic author

Can you tell me how I can create a button in the edit page to delete a record? I get a requirement that the user wants to delete a record using the edit screen instead of going back to list screen.
Thanks.

J
Jane 8/21/2009

Hi,
here is a sample:

<input type=button value=Delete onclick="window.location.href='tablename_edit.asp?editid1={$show_key1}&delete=yes';">


Then check request.querystring("delete") in the Edit page: Before process event, remove this record and redirect to the list page:

if request.querystring("delete")="yes" and request.querystring("editid1")<>"" then

str = "delete from TableName where FieldName=" & request.querystring("editid1")

Response.Redirect "tablename_list.asp"

dbConnection.Execute str

end if