1
Answer

how to prevents image not delete if image url exist another

if delete but image url use another row in grid view
how to check condition if image url count >1 than image not delete 
 
 
 
GridViewRow row = (GridViewRow)((ImageButton)e.CommandSource).Parent.Parent;
int ImgId = (int)GridImageMaster.DataKeys[row.RowIndex].Value;
fileupload1.Value = ((Label)row.FindControl("lblImage")).Text;
FileInfo OldImage = new FileInfo(Request.PhysicalApplicationPath + "ProductImages/" + fileupload1.Value);
if (OldImage.Exists)
{
OldImage.Delete();
}
Answers (1)