Back in the days of regular ASP I could easily display a table of data by looping through a recordset. In .Net I can do this making a simple DB SP call and binding the data to a grid or whatever. Works great.<BR><BR>The problem now is customizing data the look a certain way based on what is being returned. Say I am pulling out a price in dollars from a DB.<BR><BR>Using the datagrid I can bind this data to it and it makes a table for me all nice an neat.<BR><BR>BUT....what if I want to customize this price. For example, say I am returning 10 prices...if the price is 0 or less I want to put some text in front of it like...<BR><BR>NEED WORK $0.00<BR><BR>or if between 0 and $10.00...<BR><BR>GOOD $9.45<BR><BR>or if above $10.00...<BR><BR>AWESOME $13.23<BR><BR>...I am basically trying to find a way to add some "if then" logic into the data as it comes out of the DB but before it binds to the data grid.<BR><BR>What is the best way to deal with this??? Again, the above is only an example...there are many times I may want to show a certain image or something per row in a table based on a certain data field.<BR><BR>Any ideas besides looping through a recordset...I basically want to keep the power of the datagrid and databinding but be able to customize the output a little more.<BR><BR>Even with a datalist I don't know if this can be done. Guess what I need to know is WHERE do I put the logic for the "if then" stuff?In your DataBinding do:<BR> <BR><%# fnCalculateValue(DataBinder.Eval(Container.DataIte m, "CustPrice")) %><BR><BR>Where fnCalculateValue is a function and 'CustPrice' is the name of the field that contains the value that you need to do conditional processing on.<BR> <BR>Then, the fnCalculateValue function would look like this:<BR> <BR>Function fnCalculateValue(Object strPrice) as String<BR> <BR> Dim strToAppend As String<BR> <BR> If Not IsNumeric(strPrice) Then<BR> strPrice = 0<BR> Else <BR> strPrice = CInt(strPrice)<BR> End If<BR> <BR> If strPrice = System.DbNull.Value Or strPrice = 0 Then<BR> strToAppend = "NEED WORK"<BR> ElseIf strPrice > 0 And strPrice < 10 Then<BR> strToAppend = "GOOD"<BR> Else<BR> strToAppend = "AWESOME"<BR> End If<BR> <BR> Return strToAppend & " " & FormatCurrency(strPrice,2)<BR> <BR>End FunctionAwesome, that is exactly what I was looking for...can't believe it was that easy. Thanks!