Click here to Skip to main content
15,895,799 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I showing images in gridview using image control.That all images stored in folder,i just save path of that image in database.so i want help to doing like this,When i delete that image from gridview by using button of delete,it will also delete from that folder.
Posted
Comments
[no name] 22-Jul-14 14:55pm    
And the code you have written is where? Is there some problem with the code that you have written?
Pratiik Miistry 22-Jul-14 15:05pm    
Actually i dont know the exact code to delete image. I am storing image-path in databse and showing it in gridview using image control by writing ImageUrl='<%# "../"+Eval("imagepath") %>'.
"imagepath" is colomn name of database-table.
Pratiik Miistry 22-Jul-14 15:06pm    
so if i get path of that image from database then how i delete that image from folder.

1 solution

Use the System.File class and call File.Delete(path)

http://msdn.microsoft.com/en-us/library/system.io.file.delete(v=vs.110).aspx[^]
 
Share this answer
 
Comments
Maciej Los 22-Jul-14 16:12pm    
Short and to the point!
+5
Sergey Alexandrovich Kryukov 22-Jul-14 16:42pm    
Yes, a 5.
—SA

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