This topic is locked
[SOLVED]

 BeforeDelete EVENT

12/9/2009 2:37:59 PM
ASPRunnerPro General questions
E
Eddan author

Hi
I´m tryng to use BeforeDelete event and just dont get it to work.
my table contains several columns and one of the columns is named "sale_agresso_attest", the field is shown as radiobuttons Yes or No on page.

now I have manage to do by using in list page "After record processed" that the "Edit" link is not avaiable if the field_value is "Yes"
How do i use the event BeforeDelete code, so a user is NOT able to delete a record if the value is "Yes" but it is ok if the value is "No"

I´m quite new at this so it would be nice if someone of you can just give me an example code that I can modify..
please help!!

J
Jane 12/10/2009

Hi,
here is a sample BeforeDelete event:

if deleted_values("sale_agresso_attest")="Nej" then

BeforeDelete=False

else

BeforeDelete=True

end if
E
Eddan author 12/12/2009



Hi,
here is a sample BeforeDelete event:

if deleted_values("sale_agresso_attest")="Nej" then

BeforeDelete=False

else

BeforeDelete=True

end if



Thanks Jane
worked just fine, I putted in another bit och code that would do a pop-up that says "you can not delete this record" but the pop-up do not show.

do you see any error in this bit of code+



if deleted_values("sale_agresso_attest")="Nej" then

BeforeDelete=True

else

BeforeDelete = False

Response.Write "<script>alert('You can not delete this record')</script>"

end if


best wishes

Eddan

E
Eddan author 12/12/2009



Thanks Jane
worked just fine, I putted in another bit och code that would do a pop-up that says "you can not delete this record" but the pop-up do not show.

do you see any error in this bit of code+



if deleted_values("sale_agresso_attest")="Nej" then

BeforeDelete=True

else

BeforeDelete = False

Response.Write "<script>alert('You can not delete this record')</script>"

end if


best wishes

Eddan


fixed... I saw the missed part :-)



flush_output

if deleted_values("sale_agresso_attest")="Nej" then

BeforeDelete=True

else

BeforeDelete=False

Response.Write "<script>alert('You can not delete this record')</script>"

end if