GridView - Format Cell To Remove Trailing Zeros From Decimal Value
Posted on 2006-06-01
I’m using ASP.NET 2 with VB and SQL Server. I’m using the GridView control. The 2nd column on my grid contains decimal values. The GridView displays it as 15.3300000000000000. How do I format the 2nd column to remove the trailing zeros? I would like it formatted as 15.33?
My code is as follows:
Private Sub LoadSourceReports()
sCon = oCon.SqlConString
Dim Con As SqlConnection = New SqlConnection(sCon)
sSql = "Select [Source of Reports],[%],Number from vwSourceReports_2"
Dim da As New SqlClient.SqlDataAdapter(sSql, sCon)
Dim ds As New DataSet
ds = New DataSet()
Me.grdSourceReports.DataSource = ds