Display Two Columns In A Listbox

I have a dropdown list in my view, it is populating from driver_master table, driver_master table contains first_name, last_name,driver_id etc., I want to show the first_name and last_name as display text and driver_id as value in list, I want to display driver_id as value and first_name,last_name as display text.I done the following method but still i did not get the result.

In Model:

function getFullName()


return $this->first_name.' '.$this->last_name;


function getDrivers()


$drivers = driverMaster::model()->findAll();

$list    = CHtml::listData($drivers, 'driver_id', 'fullName');

return $list;


In View:

echo $form->dropDownList($model,‘driver_id’,$model->getDrivers());

i am getting the driver_id but i could not get first_name & last_name

it is working fine for me

its fine with me…check ur first_name & last_name

Thanks for your response, I solved the problem by doing the following method

$models = DriverMasterModel::model()->findAll();

$data = array();

foreach ($models as $rows)

$data[$rows->driver_id] = $rows->first_name.' '.$rows->last_name;     

echo $form->dropDownList($model, ‘driver_id’, $data ,array(‘prompt’ => ‘Select’));

[color="#006400"]/* moved from Bug Discussions */[/color]