Flash Message After Delete Action

How to display success (or not ;)) flash messages, when deleting from view.php (generated with gii)?

My Controller method actionDelete looks like:

    public function actionDelete($id) {

        try {


            Yii::app()->user->setFlash('error', "Item has been deleted.");

        } catch (CDbException $e) {

            Yii::app()->user->setFlash('error', "Cannot delete this item.");



and it works when deleting from admin.php (with CGridView) but from view.php it shows message, when error (when success - it doesn’t), but message is shown on empty, unformatted page…

Thanks in advance for your help.


Is there a quick and easy way to show all messages for success/error when saving (adding=inserting), editing (updating) and deleting?

please see wiki

I hope it’s some help.

Nice, thank you so much - didn’t know about Yii Wiki :)