Most of the Yii widgets will have an “id” property that you can set at initialization and in case you don’t set it, then it will show that auto-generated id.
I.E:
$this->widget('zii.widgets.grid.CGridView', array(
'id'=>$modelName.'-grid',//if i wouldn't set it here, Yii would generate it for me.
'dataProvider'=>$location->search(),
'filter'=>$location,
'filterPosition'=>'footer',
'filterCssClass'=>'hidden',
'itemsCssClass'=>'items',
'selectableRows'=>0,
[...]
To remove the id, i think you can just set it to null (didn’t tried).
To give the widget a certain class, use the htmlOptions property, almost all the widgets have this.
To be sure that you pass the right properties, just use the documentation and see what properties are available for the widget you use.