Deleting files on web server via browser - a specific problem

H

Hrvoje Vrbanc

Hello,

this is a problem I came upon while building a site based on MCMS 2002 but
it's not strictly MCMS-oriented:
I have a page that displays a certain content in presentation mode but when
an editor clicks "Switch To Edit Site" in MCMS console on the page, the page
displays a different content, an interface that editor use for upload and
deleting files on the web server. There are no problems with the upload but
there is a problem with file deleting.

I built a DataGrid control that displays the file list and has a column with
checkboxes. Editor then marks the files for deletion with clicks on
checkboxes, clicks on a button and File.Delete() should do the job. Except
for the one thing: even the first rendering of the page (after clicking
"Switch To Edit Site") is a postback. Therefore, I cannot put DataGrid
binding event inside "If Not IsPostBack" because in that case nothing gets
displayed. If I put the binding event outside "If Not IsPostBack" clause,
then the DataGrid gets re-created each time the page is loaded and checked
checkboxes are annulated (emptied) and the informations about what boxes are
checked never go through to Button OnClick event. Therefore, there's no
program error but the effect is as if no checkboxes were being checked and
no files are deleted.

What to do?
Maybe some viewstate could preserve the informations?

Thank you,
Hrvoje
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,525
Members
44,997
Latest member
mileyka

Latest Threads

Top