protected void datalistpics_DeleteCommand(object source, DataListCommandEventArgs e) { nszillow.clsprppic obj = new nszillow.clsprppic(); List <nszillow.clsprppicprp> objprp; Int32 prppiccod = Convert.ToInt32(datalistpics.DataKeys[e.Item.ItemIndex]); objprp = obj.Find_Rec(prppiccod); obj.Delete_Rec(objprp[0].prppiccod); System.IO.File.Delete(Server.MapPath("../prpfils/" + datalistpics.DataKeys[e.Item.ItemIndex].ToString() + objprp[0].prppicfil)); datalstbind(); }
protected void datalistpics_ItemDataBound(object sender, DataListItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { Int32 prppiccod = Convert.ToInt32(datalistpics.DataKeys[e.Item.ItemIndex]); nszillow.clsprppic obj = new nszillow.clsprppic(); List <nszillow.clsprppicprp> k = obj.Find_Rec(prppiccod); Literal litrl = (Literal)(e.Item.FindControl("literal1")); if (k[0].prppicsts == 'P') { litrl.Text = "<img src='../prpfils/" + k[0].prppiccod.ToString() + k[0].prppicfil + "' height='300px' width='300px'/>"; } else { litrl.Text = "<embed src='../prpfils/" + k[0].prppiccod.ToString() + k[0].prppicfil + "' height='300px' width='300px' autoplay='false'/>"; } } }