Click here to Skip to main content
15,867,686 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi guys
How to delete files in the repeater from the directory

What I have tried:

ASP.NET
<asp:Repeater ID="MyRPT" runat="server">
  <ItemTemplate>

    <asp:Label ID="NameAndFamily_lbl" runat="server" Text='<%#Eval("Name")%>'></asp:Label>
    <img ID="FileAttachment_img" src='<%#Eval("FileAttachmentURL")%>'/>

  </ItemTemplate>
</asp:Repeater>


C#
protected void DeleteMyPost_Click(object sender, EventArgs e)
 {

       //Delete item from DB (this is ok)

       //Delete all files from directory (this is my problem)

 }


Do you have a solution to this problem?
Posted
Updated 27-May-18 19:21pm
Comments
Richard MacCutchan 26-May-18 8:57am    
You are deleting files from the server.
Member 10871138 26-May-18 22:55pm    
yes.
ican delete file from server.
File.Delete(Request.MapPath("~/" + FileUrl));
but i want to delete multiple files from server with urls in repeater
Richard MacCutchan 27-May-18 3:03am    
What is the actual problem?

1 solution

i want to delete 3 files from server after press "Delete current form" button
ScreenShot
 
Share this answer
 
Comments
Richard MacCutchan 28-May-18 3:52am    
This is not a solution, and nor is it a question. If you will not explain exactly what the problem is then it is impossible to offer suggestions.
Member 10871138 28-May-18 5:43am    
I want to delete the files in the repeater from the "~/files" folder.

I know that we need two loops.
First, read the repeater, then delete the file from server with "FileUrl" and Repeat again.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900