I think the issue was by ths following , there are several ways to solve this problem. One that is probably the cleanest would be to add a DataGridTemplateColumn for credit as well as debit, bind both columns to "Value" and then toggle the Visibility property of the element that diaplys the value (e.g. TextBlock) by using also a binding to "Value" and a converter. Example:
'name' => 'm1.pimg', //assuming the relation to model1 in model2 is named m1
'htmlOptions' => array('style' => 'width: 100px;'),
'value'=>'...',// if required
To fix this issue select * is a bad practice (what if your tables grow to dozens of columns and you need just 1?). But you could alias the column (select table1.foo foo1, table2.foo foo2...) That should work because then you could bind to table1.foo1 and table2.foo2 -- they will be different column names.
How to display csv file data in unbound data grid view columns