Thursday 9 August 2012

Manipulate FormView values in the code behind

Instead of:
<asp:Label ID="Label_Age" runat="server" Text='<%# Eval("CalculatedAgeMonths") %>' />

Use:
<asp:Label ID="Label_Age" runat="server" Text='<%# ConvertToYearsMonths(Eval("CalculatedAgeMonths")) %>' />

And in your code behind:

Function ConvertToYearsMonths(CurrentMonths As Integer) As String
     Return "in Years!!"
End Function

No comments:

Post a Comment