CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 access control in before build delete event

Print topic Send  topic

Author Message
Don Safar
Posted: 02/13/2004, 12:53 PM

I am trying to access the value of a control on an editable grid with a
delete checkbox on each row. In the beforeshow row event I have a line of
code - response.write "<br>img_name:"&dispimages2.image_url.Value that
displays this - img_name:20042131319260.breakfastnook.jpg . In the
beforebuilddelete event when I try to display the value of the control I
get nothing. I need the value, so I can delete the physical file that the
record points to. I assume the beforebuilddelete event operates on a row by
row basis in the grid where the checkbox is selected.

Don Safar
Posted: 02/13/2004, 2:52 PM

Here is the solution I came up with. This code is in
BeforeExecuteDeleteEvent (probably needs to be in AfterExecuteDelete, but at
that point DataSource.Where no longer contains anything - guess I could save
it in beforeexecutedelete then use it in afterexecutedelete :-). )
Dim myFile, ImagePath, myImage, myID
Set myFile = CreateObject("Scripting.FileSystemObject")
myImage =
CCDLookUp("image_url","tblPermitUploads",dispimages2.DataSource.Where,
DBLee8)
myID =
CCDLookUp("permit_id","tblPermitUploads",dispimages2.DataSource.Where,
DBLee8)
ImagePath = Server.MapPath("uploads/")
ImagePath = ImagePath & "/" & myID & "/" &myImage
myFile.DeleteFile(ImagePath)

Not sure if this is the most elegant solution, but it works. I use the
Datasource.Where to lookup the image name (img_url) and the ID(parent id).
Images are stored in path uploads/ID/imagename which ties all images back to
the parent record id that owns them. This same information is in hidden
fields on each row of the editable grid, but I could not figure out how to
reference them.

"Don Safar" <donsafar_remove_@hotmail.com> wrote in message
news:c0jdfs$ad8$1@news.codecharge.com...
> I am trying to access the value of a control on an editable grid with a
> delete checkbox on each row. In the beforeshow row event I have a line of
> code - response.write "<br>img_name:"&dispimages2.image_url.Value that
> displays this - img_name:20042131319260.breakfastnook.jpg . In the
> beforebuilddelete event when I try to display the value of the control I
> get nothing. I need the value, so I can delete the physical file that the
> record points to. I assume the beforebuilddelete event operates on a row
by
> row basis in the grid where the checkbox is selected.
>
>

Pinochet


Posts: 13
Posted: 08/04/2004, 11:37 AM

Thanks Don, I was having the same problem, and your post helps out alot.

Has anyone else had this problem and figured out an other solutions to this issue?

Would be great if it were possible to reference objects, row by row, in the delete events maybe a beforedeleterow event.

Strange thing is you can reference the row after the row you are trying to delete. Meaning, if you check the checkbox for deletion and have code in the beforebuilddelete or afterexecutedelete you can get values for fields in the rows after the row that was just deleted but not for the rows that were deleted and you cannot perform code based on the values of fields in rows to be deleted.

So, in my case deleteing a file off the server based on the files name in my table would delete the file after the file I was trying to delete but would remover the correct file from the DB.

jeff
_________________
don't worry it doesn't mean anything anyway
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.