1
Reply

how to prevents image not delete if image url exist another

Devendra  Kumar

Devendra Kumar

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