I have this code that search the tables if the media is use inside the content. but my problem is the delete transaction is not cancelled even if I set it to true.
string sql = string.Format(@"
SELECT TOP 1 A.[id] from cmsPropertyData AS A
LEFT JOIN cmsPropertyType AS B ON A.propertytypeid = b.id
where B.dataTypeId IN ('5697','5698','6397','6410','6411','6419','6420','6421')
and (A.[dataNvarchar] = '%{0}%') order by A.[id]"
, sender.Id);
using (IRecordsReader dr = SqlHelper.ExecuteReader(sql))
{
try
{
if (dr.HasRecords)
{
e.Cancel =
true;
//Log.Add(LogTypes.Delete, sender.Id, "This item cannot be deleted because it is currently used in the content section");
//ShowErrorBubble("Error deleting item", "This item cannot be deleted because it is currently used in the content section");
}
}
catch (Exception ex)
{
Log.Add(LogTypes.Custom, sender.Id, "Error deleting a media " + ex.Message + "-" + sender.Text);
prevent delete of media
Hi,
I have this code that search the tables if the media is use inside the content. but my problem is the delete transaction is not cancelled even if I set it to true.
Hi,
What event are you running this code in?
-Tom
is working on a reply...