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.
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Lalit MPosted Mar 4, 2010, 4:57 AM
<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;
Raaj KumarPosted Mar 4, 2010, 4:49 AM
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
Amit ChoudharyPosted Mar 4, 2010, 4:48 AM
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.