$rid = ""
if( isset( $_GET['rid'] ) {
$rid = $_GET['rid'];
}
<?php $this->widget('zii.widgets.grid.CGridView', array(
'id'=>'guests-grid',
'dataProvider'=>$model->search(),
'filter'=>$model,
'columns'=>array(
'name',
'address',
'contact_numbers',
'email_addresses',
/*
'company_name',
'company_contact_nos',
'person_to_notify_emergency',
'person_to_notify_contact_no',
*/
array(
'class'=>'CButtonColumn',
'viewButtonUrl' => 'Yii::app()->createUrl("guests/view",array("id"=>$data->idGuests,"rid"=>"$rid"))',
),
),
)); ?>
I’m sure the $rid exist because this is my url
http://localhost/mysite/index.php?r=guests/admin&rid=1
Here’s the error:

The error is caused by the viewButtonUrl, I know that the reason why $_GET[‘rid’] has an error because all variables in a CGridView should b in the $model variable.
Is there a way to fix this one? Your help will be greatly appreciated and rewarded!
Thanks!
The problem is that you’re using single quotes and thus giving the variable to the CGridView component.
CGridView then tries to parse the string. However, in CGridView’s context, there isn’t a variable
$rid.Use double quotes in this case and escape the double quotes inside the string.
Becomes