I'm afraid it is a standard behavior and there is no setting out there to change this.
But I can propose a workaround...
When the ribbon Delete button is pressed on a list form, SharePoint requests user confirmation, and then performs postback. Thus, redirection happens server-side and nothing could be changed here.
However, nothing prevents you from deleting the item client-side (using client object model), and then you can just close the dialog using either SP.UI.ModalDialog.commandModalDialogClose method or window.frameElement.commitPopup shortcut.
The code will look something like this:
if (!confirm("Are you sure want to delete this item?")) return;
var context = new SP.ClientContext.get_current();
var list = context.get_web().get_lists().getByTitle(listTitle);
var item = list.getItemById(parseInt(GetUrlKeyValue("ID")));
item.recycle();
if (GetUrlKeyValue("IsDlg") != "1")
context.load(list);
context.executeQueryAsync(
function()
{
if (GetUrlKeyValue("IsDlg") == "1")
{
window.frameElement.commitPopup("item deleted");
}
else
{
document.location.href=list.get_defaultViewUrl();
}
},
function(sender,args) {alert('Error! ' + args.get_message());});
To make this code work, of course you will need to replace standard Delete button with your own custom one, which will look alike, but will act differently.
You will need to perform this operation for all list forms. Initial button definitions can be grabbed from the 14\TEMPLATE\GLOBAL\XML\CMDUI.XML file.
For example, standard definition of Delete button on Display form is presented below:
<Button
Id="Ribbon.ListForm.Display.Manage.DeleteItem"
Sequence="50"
Command="Ribbon.ListForm.Display.Manage.DeleteItem"
Image16by16="/_layouts/$Resources:core,Language;/images/formatmap16x16.png" Image16by16Top="-112" Image16by16Left="-224"
Image32by32="/_layouts/$Resources:core,Language;/images/formatmap32x32.png" Image32by32Top="-128" Image32by32Left="-128"
LabelText="$Resources:core,cui_ButDeleteItem;"
ToolTipTitle="$Resources:core,cui_ButDeleteItem;"
ToolTipDescription="$Resources:core,cui_STT_ButListFormDeleteItem;"
TemplateAlias="o2"/>
Obviously, you need to change Id and Command attributes here, providing your own identifiers.
Then, wrap this code into CommandUIDefinition element, setting Location attribute to original ID value:
<CommandUIDefinition Location="Ribbon.ListForm.Display.Manage.DeleteItem">
<Button
Id="Ribbon.Ryan.DeleteItem"
Sequence="50"
Command="Ribbon.Ryan.DeleteItem"
...
/>
</CommandUIDefinition>
Repeat the trick for Edit form, and then wrap these CommandUIDefinition elements into proper CustomAction code, and of course do not forget to provide command handler for the "Ribbon.Ryan.DeleteItem" command and put the code presented above there :)
For details of how ribbon customizations are performed, and for examples of custom action code, you can examine the following MSDN how-to:
(Location attribute of the CustomAction element should be set to "CommandUI.Ribbon", to apply the customization to all list forms).