Here you are relying on however .NET natively formats decimals.
To format as currency, you function should either do the formatting and
return a string, or in your script block, you should wrap your call out to
the function in something that will do the formatting.
"D. Shane Fowlkes" <> wrote in message
news:...
> Hey guys. I have a Repeater and a Template. One of the dataitems calls a
> helper function. The dataitem sends the record ID to the function and the
> function runs a complex query and returns a calculation which is a dollar
> amount. The ID is a "construction project" and the helper function goes
> and determines how much money has already been spent against the project
> by querying expenditure tables.
>
> The function works fine but how can I format the output to be currency? I
> also noticed that even though my function returns data of a Decimal type,
> it seems to come out as a Integer. No "cents" are written to the page.
>
> Thanks!
>
> (In VB)
>
> <code>
>
> Function CalculateExpended(intBudgetID As Integer) As Decimal
>
> Dim objConnection As SqlConnection
> Dim cmdSelectData As SqlCommand
> Dim strConnectString As String
> Dim strSQL As String
> Dim decExpendedAmt As Decimal
>
> strConnectString =
> System.Configuration.ConfigurationSettings.AppSett ings("SqlConnection")
> strSQL = "SELECT Stuff....."
>
>
> objConnection = New SqlConnection(strConnectString)
> cmdSelectData = New SqlCommand(strSQL, objConnection)
>
> objConnection.Open()
> decExpendedAmt = cmdSelectData.ExecuteScalar()
> objConnection.Close()
>
> Return decExpendedAmt
>
> End Function
>
>
>
> In Template....
>
> Expended: <%# (CalculateExpended(Container.DataItem("ID"))) %>
>
>
>
> </code>
>
>
>
|