CHtml::ajaxLink or CHtml::ajaxButton only works for the first time?

Hi guys,

I am stuck on this problem.

The ajaxbutton only works for the first time.

view file:




<div id='current-user'>

       <?php

            $this->renderPartial( '_user', array(

                   'user' => $user, 

            )); 

</div>




_user file:




<ul>

    <li><?php echo $user->name; ?></li>

</ul>

<?php

     echo CHtml::ajaxLink( 'next',  array( 'user/next',  'userid'=>$user->id, 'rand'=>rand(1, 1000) ), array(  'update' => '#current-user', 

));

?>



the controllerAction:




public function actionNext($userid)

{

       $userid++;

       $newUser = User::model()->findByPk($userid);

       $this->renderPartial( '_user', array( 

               'user'=>$newUser,

       ));

}



Any advice are appreciated.

thanks in advance for your help


$this->renderPartial( '_user', array(

                   'user' => $user, 

            ), false, true); 

There are lots of topics covering this situation. read through the forum.

Thanks a lot, it works.

Could you please tell some keywords about this situation.

read this http://www.yiiframework.com/doc/api/1.1/CController#renderPartial-detail

and post your questions if you don’t understand anything but it should be straight forward. Also it is good practice to search the forum before you post. I almost always find the answer to my questions that way