View Single Post
  #4 (permalink)  
Old February 23rd, 2007, 07:20 PM
rsearing rsearing is offline
Friend of Wrox
 
Join Date: Jul 2006
Location: olathe, ks, USA.
Posts: 238
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via MSN to rsearing
Default

This would work great if I wanted the actual data that was returned from the data source, but I actually tweak the values being returned and then post to the datalist.

For example, I am pulling back from my query a "totalSumMinutes" value...in my DataList, however, my binding is personalized to go through a personalized function that has two methods:

<datalist>
<itemtemplate>
<div style="float:left; width:40px"><asp:Label ID="Label6" runat="server" Text='<%# EventStruct.CalculateHours(Eval("total")) %>'></asp:Label></div>

<div style="float:left; width:40px"><asp:Label ID="Label1" runat="server" Text='<%# EventStruct.CalculateMinutes(Eval("total")) %>' ></asp:Label> </div>

..where the methods are below:

Public Shared Function CalculateHours(ByVal total As Object) As Integer
        Dim returnInt As Integer = 0
        If total IsNot DBNull.Value Then
            returnInt = (total / 60) - 0.5
        End If
        Return returnInt
    End Function

    Public Shared Function CalculateMinutes(ByVal total As Object) As Integer
        Dim returnInt As Integer = 0
        If total IsNot DBNull.Value Then
            returnInt = total Mod 60
        End If
        Return returnInt
    End Function

So, you can see, that simply setting the Datagrid's datasource will not give me the output I need.

I actually need to figure out how to render the datalist somehow.

Regards,
Rob