Hi!
i am using datagrid to display images. and i am doing. if i click delete link button images are deleted in saved location. i am traing but it deletes row and not delete images in saved folder. please help me.
Thanks.
Data grid in asp.net
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Amit ChoudharyRank #145 · 15.8K reputationPosted Mar 3, 2010, 11:48 PM EST
i already gave you solution to this question in your previous thread. I'm using that same method in my project and its working fine.
Raaj KumarRank #7,836 · 233 reputationPosted Mar 3, 2010, 11:49 PM EST
In delete button click get the image file name and delete it.
String imagePath = Imagename;
System.IO.FileInfo file1 = new System.IO.FileInfo(Server.MapPath(imagePath));
file1.Delete();
I guess in previous post you have asked like "you dont want to delete the file" :-)
http://www.c-sharpcorner.com/Forums/ShowMessages.aspx?ThreadID=80038
Regards,
raaj
Lalit MRank #1,186 · 1.5K reputationPosted Mar 3, 2010, 11:57 PM EST
<asp:LinkButton ID="deleteButton" Text="Delete" OnClick="delete_onClick" runat="server" CommandArgument="C:\yourimagefolder path\imagename" />
Then access the command arg like this:
string fileName = (sender as LinkButton).CommandArgument;