Link to home
Start Free TrialLog in
Avatar of CantonMarko
CantonMarkoFlag for United States of America

asked on

Suppress zero values in a databound field in a gridview

Can anyone show me a way to make any cell in my gridview that has a zero value show a blank instead of the zero?
Avatar of srikanthreddyn143
srikanthreddyn143

If you are getting from a query, then you can make like

select Col1,case when col2 = 0 then ' ' else end, Col3 from tb1

Or

You can loop through

For Each Row in GrdView.Rows
If oRow.Cells("Col2").Value = 0 Then
oRow.Cells("Col2").Value = " "
End iF
Next


Above is a test code. I didnt test it.
ASKER CERTIFIED SOLUTION
Avatar of srikanthreddyn143
srikanthreddyn143

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial