Render View File From Another Model View


Am trying to render a view from another model view, however am getting the grid layout of that view but without any data. (it retrieves the labels of that model but with all data ‘Not Set’)

For more details, I have company & branch models and i want to render in the company view the branch view of the related branch.

my code is:

$branchModel = Branch::model();

$this->renderPartial('//Branch/view', array('model'=>$branchModel, 'id'=>4));

Please advise on how to solve that, and if there is a better way of doing it.

Thank you!

[color="#006400"]/* moved from Misc */[/color]


$branchModel = Branch::model()->findAll();

$this->renderPartial('/Branch/view', array('model'=>$branchModel, 'id'=>4));

But I think the model should be defined in the Contoller not in the view.

Can you post your view file? where you use a dataProvider?