Deleted the files but the browser still shows them

A

AAaron123

I had a similar problem once before and never really solved it.
Generated a work around that was not optimum.
But worked.

But I now have another one.
I don't really know how to give enough info for someone to help.
But here goes:

The DataList shows all the files in a folder.
Clicking the button deletes them all.
But the Browser still shows the files as if they ae still there.

The following image files are currently in the folder already

<asp:DataList runat="server" ID="DataListAll" RepeatColumns="1"
RepeatLayout="table"

RepeatDirection="horizontal" DataSourceID="ObjectDataSourceAll">

<ItemTemplate>

<%# Container.DataItem %>

</ItemTemplate>

</asp:DataList>


<asp:Button ID="ButtonDeleteAll" runat="server" Text="Delete All These
Files" />

<asp:ObjectDataSource ID="ObjectDataSourceAll" runat="server"
TypeName="PhotoManager"

SelectMethod="ListImportAllDirectory"></asp:ObjectDataSource>



Hope there is enough above to display the problem source.



Thanks
 
A

AAaron123

AAaron123 said:
I had a similar problem once before and never really solved it.
Generated a work around that was not optimum.
But worked.

But I now have another one.
I don't really know how to give enough info for someone to help.
But here goes:

The DataList shows all the files in a folder.
Clicking the button deletes them all.
But the Browser still shows the files as if they ae still there.

The following image files are currently in the folder already

<asp:DataList runat="server" ID="DataListAll" RepeatColumns="1"
RepeatLayout="table"

RepeatDirection="horizontal" DataSourceID="ObjectDataSourceAll">

<ItemTemplate>

<%# Container.DataItem %>

</ItemTemplate>

</asp:DataList>


<asp:Button ID="ButtonDeleteAll" runat="server" Text="Delete All
These Files" />

<asp:ObjectDataSource ID="ObjectDataSourceAll" runat="server"
TypeName="PhotoManager"

SelectMethod="ListImportAllDirectory"></asp:ObjectDataSource>



Hope there is enough above to display the problem source.



Thanks


Something just occured to me.
When does it run ButtonDeleteAll_Click
and when does it handle the
<asp:DataList and the <%# Container.DataItem %>

If it did not run ButtonDeleteAll_Click first I'd expect to see what I am
experinecing.
Is ther a way to force the ButtonDeleteAll_Click to run before the other?

Suppose I put the code from ButtonDeleteAll_Click into page_load with a
check to see if ButtonDeleteAll caused the postback? Is that earlier enough?

(Assuming I could figure out how to do that check :))

Thanks
 
A

AAaron123

AAaron123 said:
Something just occured to me.
When does it run ButtonDeleteAll_Click
and when does it handle the
<asp:DataList and the <%# Container.DataItem %>

If it did not run ButtonDeleteAll_Click first I'd expect to see what
I am experinecing.
Is ther a way to force the ButtonDeleteAll_Click to run before the
other?


Suppose I put the code from ButtonDeleteAll_Click into page_load with
a check to see if ButtonDeleteAll caused the postback? Is that
earlier enough?
(Assuming I could figure out how to do that check :))

Thanks

Putting it into Page_load didn't work.
I used the debugger to see that it did indeed delete.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load

'Runs before ButtonDeleteAll_Click

Dim zz As String = Request.Form("__EVENTTARGET")

If zz IsNot Nothing AndAlso zz.Contains("ButtonDeleteAll") Then

PhotoManager.DeleteAllFilesInFolder(Server.MapPath("~/Admin-Albums/Import/"))

End If

End Sub



Pretty esoteric problem so I'm not suprised if no one know how to get around
it but I'm willing to try any reasonable suggestion.



Thanks
 

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,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top