Cpagination Cant show data of next page

I am using Cdbcriteria and I want to implement cpagination in this example all thing working for me. But I clicked to next page the data cant be loaded as below

============================================================================

if (!isset($_GET[‘page’]))

			Main::setResult(serialize($_POST));


				


			Main::out(unserialize(Main::getResult()));


			


				


			$data = unserialize(Main::getResult());


			


			


			if(!empty($data['name']))


		     $rid = Region::model()->findByAttributes(array('name'=>$data['name']))->region_id;


		     $criteria = new CDbCriteria;


			


		     


		     $criteria->limit = 1;


		     $criteria->offset =0;


		     


						


			if(!empty($rid))


				$criteria->addInCondition("region_id", array($rid));


				


			if(!empty($data['postcode']))


				$postcode = $data['postcode'];


				


			if(!empty($postcode))


				$criteria->compare('postcode','='.$postcode);





			


			if(!empty($data['agentname']))


				echo $agentname = $data['agentname'];


				


			if (!empty($agentname))


				$criteria->addSearchCondition('name', $agentname);


				


				$agentdata = Agent::model()->findAll($criteria);


				


				$count=Agent::model()->count($criteria);


								


				


				$pages=new CPagination($count);


				$pages->pageSize=1;


				$pages->applyLimit($criteria);

$this->render(‘someview’,array(‘pages’=>$pages));

=========================================================

In view i had used pager as

=========================================================

 <?php if($pages!=null):?>


		<?php $this->widget('CLinkPager', array('maxButtonCount'=>7,'header'=>'',


'pages' => $pages,


				//'order'=>$sort,

)) ?><?php endif;?>

Please use editor to format your code.

Why do you pass only pages to a rendered file?

Which error do you get?

Also, you may simplify your code to concentrate on the problem itself (it may help you to find the problem also)