Cgridveiw To Display

Hi all,

when a person clicks on a category display him all products under category in a gridview

view preson

<?php $this->widget('zii.widgets.grid.CGridView', array(













 )); ?>[code]


controller person

 public function actionProductcategory($id)


$model=new Product;



model in products

 public function SelectedCategoryProducts($id)


    $sql="select name,model,price,brand from fc_product 

    WHERE category=".$id;




 return new CSqlDataProvider($sql, array(

'sort' => array(

    'attributes' => array(

         'Name', 'Model', 'Brand','Price',



'pagination' => false));



 Property "Product.SelectedCategoryProducts" is not defined.

PLEASE HELP! am losing may mind on this … not able to display gridview

dont use this code in model. just write it in your view like this

[color="#006400"]$sql="select name,model,price,brand from fc_product

WHERE category=&quot;.&#036;id;


$data = CSqlDataProvider($result);[/color]

set dataprovider=>$data,

you can also write this using CDataprovider. i prefer this one. :)