following is my code in view but i am unable to create button in cgridview
<?php echo CHtml::link('Advanced Search','#',array('class'=>'search-button')); ?>
<div class="search-form" style="display:none">
<?php $this->renderPartial('_search',array(
'model'=>$model,
)); ?>
</div><!-- search-form -->
<?php $this->widget('zii.widgets.grid.CGridView', array(
'id'=>'product-grid',
'dataProvider'=>$model->countregister($_GET['id']),
'enablePagination' => true,
'filter'=>$model,
'columns'=>array(
'name',
'email',
array(
'class'=>'CButtonColumn',
'template'=>'{Register}{update}{view}',
'buttons'=>array(
'Register'=>array(
'label'=>'Register',
'url'=>Yii::app()->createUrl('register/create',array(
'id'=>$_GET['id'],
'rid'=>$_GET['rid']
))
)
),
),
),
)); ?>
passed rid to query string i am getting this error
Parse error: syntax error, unexpected '/' in D:\wamp\www\yii\framework\base\CComponent.php(612) : eval()'d code on line 1
the register button appears with the above error but if click doesnt go to the specified URL
PLEASE HELP let me know how can i make up
change your code to this
<?php $id=$_GET['id'];
$rid=$_GET['rid']; ?>
<?php $this->widget('zii.widgets.grid.CGridView', array(
// rest of your code
'url'=>"Yii::app()->createUrl('register/create',array(
'id'=>$id,
'rid'=>$rid
))"
more details
'buttonID' => array
(
'label'=>'...', //Text label of the button.
'url'=>'...', //A PHP expression for generating the URL of the button.
'imageUrl'=>'...', //Image URL of the button.
'options'=>array(), //HTML options for the button tag.
'click'=>'...', //A JS function to be invoked when the button is clicked.
'visible'=>'...', //A PHP expression for determining whether the button is visible.
)