Yii Framework Submitbutton Ajaxsubmitbutton Out Side The Cgridview Manage The Row Values With Setflash

In View::


<div id="updateDiv">

<?php 	foreach(Yii::app()->user->getFlashes() as $key => $message) 

					{

					echo '<div class="flash-' . $key . '">' . $message . "</div>\n";

					}

?>

</div>


<?php echo CHtml::beginForm(); ?>

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

	'id'=>'Test_Grid_view',

	'dataProvider'=>$model->search(),

	'filter'=>$model,

	'columns'=>array(

		'attribute1',

		'attribute2',

		array(

		       'id' => 'selectedGridRowId',

		       'class'=>'CCheckBoxColumn',

		 	 ),

	

		),

)); ?>


<!--submitButton-->

<div align="right">

<?php echo CHtml::submitButton('ManageCgridView', array('name' => 'ManageCgridView')); ?>

	<?php echo CHtml::submitButton('Cancel',array('name'=>'cancel')); ?>

<?php echo CHtml::endForm(); ?>

</div>


<!--ajaxSubmitButton-->

<div align="right">	

				

<?php	echo CHtml::ajaxSubmitButton("ManageCgridView", $this->createUrl('/Controller/action'),

 array(

 "type" => "post",

"data" => "js:{chk:$.fn.yiiGridView.getSelection('Test_Grid_view')}",

"update" => "#updateDiv",

'beforeSend' => "function() { $.fn.yiiGridView.update('Test_Grid_view', {    data:'data',});        }",

)); ?>


</div>



In Controller::

Action For submitButton:


<?php

	public function actionSubmitAction()

	{

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

    {

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

        {

        echo "Selected Grid view Id is ==".$_POST['selectedGridRowId'][0];

		$model=new Model;

		//do functionality

		}

		else 

		{

		Yii::app()->user->setFlash('notice', "Please set flash notification here");

		$this->redirect(array('action'));

		}

	}

		$model=new Model('search');

		$model->unsetAttributes();  // clear any default values

		if(isset($_GET['Model']))

			$model->attributes=$_GET['Model'];

	$this->render('viewFile',array('model'=>$model,));

	}

?>

Action For ajaxSubmitButton::




<?php

	public function actionAjaxSubmitAction()

	{	

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

		{

		echo $_POST['chk'][0];

		//do functionality

		

		$model=new Model('search');

		$model->unsetAttributes();  // clear any default values

		if(isset($_GET['Model']))

			$model->attributes=$_GET['Model'];


		$this->renderPartial('ViewFile',array('model'=>$model),false,true);

		}

		  

		else

				{

					Yii::app()->user->setFlash('notice', "Please set flash notification here");

					foreach(Yii::app()->user->getFlashes() as $key => $message) 

					{

					echo '<div class="flash-' . $key . '">' . $message . "</div>\n";

					}

				}   

	}

	

	?>

Please post comment for any queries

Thanks,

Srikanth