View Full Version : Deleting records & page refresh
bean262
05-06-2005, 08:32 PM
Ok, another page another issue -
I have a page that pulls info from the Db and it displays in a table format. I was successful in populating the table and in placing a "DELETE" icon next to each record. Currently the page works so that when I click on the "DELETE" icon the record is deleted from the DB and page appears to refresh. But the "deleted" record still appears in the table. To get the record to not appear in the table, I have to click the Delete button a second time. IS there a way to get it so that I can click the delete icon and have it refresh the page with the deleted record NOT remaining?
I can provide code examples is you want...
Thanks!
Basscyst
05-06-2005, 10:20 PM
If you are posting your form to the same page. You should call the record delete prior to displaying the current records. This would make it work as expected.
ex:
If Request.QueryString("QueryStringName") <> "" Then
DeletionCode
End If
Code for retrieving current records.
Basscyst
Bullschmidt
05-10-2005, 10:13 PM
If you are posting your form to the same page.
And for more about that:
Perhaps this may hopefully give you some ideas:
Classic ASP Design Tips - Post Back Page
http://www.bullschmidt.com/devtip-postbackpage.asp
Perhaps have most Web pages "post back" to themselves and then handle further processing from there. This can often cut down on the number of pages that need to be developed and the related back-and-forth involved with many pages.
To make the form post back to the same page:
<form id="frmMain" name="frmMain" action="<%= Request.ServerVariables("SCRIPT_NAME") %>" method="post">
And here are some buttons:
<% ' *** btnClose %>
<input type="submit" name="btnClose" value="Close">
<% ' *** btnSave %>
<input type="submit" name="btnSave" value="Save">
<% ' *** btnNew %>
<input type="submit" name="btnNew" value="New">
<% ' *** btnDel %>
<input type="submit" name="btnDel" value="Delete" onclick="return confirm('Are you sure you want to delete this record?');">
To handle processing toward the top of the page:
If Request.Form("btnClose") <> "" Then ' Close btn.
' Close.
Call ClosePg()
Elseif Request.Form("btnSave") <> "" Then ' Save btn.
' Set var.
Call SetVar("frompost")
' Save rec.
Call SaveRec()
Elseif Request.Form("btnNew") <> "" Then ' New btn from this pg.
' Set var.
Call SetVar("new")
Elseif Request.Form("btnDel") <> "" Then ' Del btn.
' Set var.
Call SetVar("frompost")
' Del rec.
Call DelRec()
' Set var.
Call SetVar("new")
Elseif Request.QueryString("CustID") <> "" Then ' CustID from Many pg.
' Set var.
Call SetVar("fromdb")
Elseif Request.QueryString("CustID") = "" Then ' Add btn from MainMenu pg.
' Set var.
Call SetVar("new")
End If
And the ClosePg(), DelRec(), SaveRec(), and SetVar() functions above are custom functions that would still need to be developed.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.