Yii::app()->getClientScript()->registerCssFile(
Yii::app()->getAssetManager()->publish(
Yii::getPathOfAlias('zii.widgets.assets')).'/detailview'.'/styles.css');
This script will only generate the assets files such as javascript or css style for the widget like cdetailview or any other widget.
This script is found in the framework so if anyone wants to know how to getting styles only from cdetailview or cgridview. this is how.