Configuring Links In Gridview

I’m trying to get a column to display links that should be pointing to individual records, but I can’t seem to find how it should be done.

Here’s a snippet of my view file:


$this->widget('bootstrap.widgets.TbGridView', array(

    'type'=>'stripped condensed',






            'header'=>'crew code',


            'value'=>"CHtml::link('crew_code', array('test/test'))"),

        array('name'=>'name', 'header'=>'company name'),

        array('name'=>'phone', 'header'=>'phone number'),

        array('name'=>'email', 'header'=>'email address'),




If I remove the value attribute for crew code column, then the list is displayed just as I need it to be displayed (except it’s not a link), however I’m trying to modify it to be a link that will point to each record. To do that I need to add value attribute, yet when I add it, crew_code which is my table’s primary key turns into text, so instead of codes that I was able to see without the value attribute, I can only see actual “crew_code” text this time around.

How can I do this?

here’s my controller index:

	public function actionIndex()


		$dataProvider=new CActiveDataProvider('Crew', array(









Dear Friend

You can define a column like this to make it as a link.



	'value'=>'CHtml::link($data->name,array("medico/view","id"=>$data->id))',//Take note of single and double quotes.




Thanks, this is working perfectly!!! :)


Following your question, I just shared my solution for links in grid views.