I have a asp gridview which displays the account transactions a user have made. As in transactions, there will be debit and credit of money.
Right now, my gridview displays either
Debit Credit
$0 $100
$100 $0
and vice versa.
My question is, is there anyway to convert the 0 to a ‘-‘ so that it displays
Debit Credit
-- $100
$100 -
instead??
My gridview is binded using SQLDataSource control. and the amount is a decimal type.
Or anybody can suggest what is the correct search term for this kind of scenario?
Gridview row databound event can be used to attain this. Please refer the link GridView.RowDataBound Event for more details.
You can code like
Or you can use a for loop inside RowDataBound event if there are more columns to be formatted. Like