Devendra  Kumar

Devendra Kumar

  • NA
  • 517
  • 246.3k

how to prevents image not delete if image url exist another

Jan 27 2016 11:29 PM
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)