Auto Open Dialog In Controller

Hi, I’m new to Yii. Basically, what I’m trying to do is to auto open a dialog. What I did is that I rendered the view that contained the widget but the problem is that the index rendered twice. I tried renderPartial but the dialog did not show.

this is my Controller




public function actionIndex() {

        $model = new Model;


        $this->render('_dialog');

        $this->render('index',array(

                'model'=>$model));

    }



This is my _dialog view




<?php


$this->beginWidget('zii.widgets.jui.CJuiDialog', array(

            'id'=>'ScdModal',

            'options'=>array(

                'title'=>'Modal Dialog',

                'width'=>'auto',

                'height'=>'auto',

                'autoOpen'=>true,

            ),

        ));


        $this->renderPartial('_anotherView'

                ,array('model'=> $model));


$this->endWidget('zii.widgets.jui.CJuiDialog');



So how do you actually call the dialog from the controller? or how do I render the dialog? 'Cause obviously I did something wrong. ._.

already found the answer.