i’ve the following code in aspx page
<asp:Label ID="CittaLabel" runat="server" Text='<%# Eval("Citta") %>' Font-Size='<%# ReturnFontSize(Eval("Big")) %>'/>
and this is my code behind service function
Protected Function ReturnFontSize(ByVal Big As Boolean) As FontUnit
If Big Then
ReturnFontSize = FontSize.Medium
Else
ReturnFontSize = FontSize.Small
End If
End Function
But i get always a font very very small.
So my question is : for changing “Font-Size” proprety of a control, from code behind, which return type i have to use, assuming that FontUnit not work ?
Thank you
You have to DataBind the Containercontrol of the label(f.e. a GridView or the complete page). Then you can call a Codebehind Function from the aspx-page.
Hence f.e. in Page-Load:
and the function must return an object from type FontSize:
and on aspx-page:
But why dont you set the Fontsize in Codebehind on Page.Load?