How to Implement CTabView

Hi,

I'm trying to use CTabView, but having difficultly with it's implementation.  Maybe I haven't grasped the concept so I thought I would ask for some help.

Here is my action before using CTabView.  This basically loads up a search form.

public function actionSearch() 


	{


		$search=new SearchForm;


		if(Yii::app()->request->isPostRequest)


		{


			// collect user input data


			if(isset($_POST['ASearchForm']))


				$search->setAttributes($_POST['SearchForm']);


			// validate user input and redirect to previous page if valid


			if($search->validate())


			{


				


  			$this->redirect(array('list/list')); //send it to the list controller.


				


			}


		}


		


		$this->renderPartial('asearch',array('search'=>$search));


		


	}

When trying to use CTabView, I changed the action towards the bottom as follows:

public function actionSearch() 


	{


		$search=new SearchForm;


		if(Yii::app()->request->isPostRequest)


		{


			// collect user input data


			if(isset($_POST['ASearchForm']))


				$search->setAttributes($_POST['SearchForm']);


			// validate user input and redirect to previous page if valid


			if($search->validate())


			{


				


  			$this->redirect(array('list/list')); //send it to the list controller.


				


			}


		}


		


	$this->widget('CTabView',array('tabs'=>array(


	        'tab1'=>array('title'=>'Search','view'=>'search',array('search'=>$search)), 


'tab2'=>array('title'=>'Advanced Search'),


'tab3'=>array('title'=>'Listing ID Search'),


'tab4'=>array('title'=>'Address Search'))));


		


	}

I basically added the code for the CTabView.  Within tab1, i'm trying to create the  search view as used in the bottom of the code example 1.  It's not recognizing the php variables I'm trying to send via array('search'=>$search), giving an undefined variable error for search. 

Any help would be appreciated.

R

You should assign the data array to the 'viewData' property of CTabView instead of to 'tab1'.

Thanks Qiang.  That makes sense and it works fine.

R

Brothers, i used this widget with pagination. when i first execute my page CTabView widget works fine. but when i navigate to view another data through yii pagination, this cTabView widget does not work. what should i do ? please reply, its urgent.

thanks, TANIM