I too am a big fan of code behind but not in all cases. For example which is easier to read? Also, sometimes it is advantageous to be able to change the page without recompiling. IE: Changing the message to 'Failing grade at 68%' or something similar. The advantage to the late binding or formating is rapid change.
tedbilly
@tedbilly
Best posts made by tedbilly
Latest posts made by tedbilly
-
RE: Asp.net datagrid problem
-
RE: Asp.net datagrid problem
Because I am a big fan of self documenting code I would have named the method ConvertPercentageToPassFailString(...) or ConvertGradeToPassFailString(...)
-
RE: Asp.net datagrid problem
There is an even easier solution using a ternary operator: (C# Sample Code)
<asp:TemplateColumn HeaderText="Status">
<ItemTemplate>
<asp:Label runat="server" Text='<%# ((int)DataBinder.Eval(Container, "DataItem.percentage") < 70 ? "Fail" : "Pass") %>'>
</asp:Label>
</ItemTemplate>
</asp:TemplateColumn> -
RE: Argument of using boolean datatype...
I use a BIT which can be a 0 or a 1. The probalem with a CHAR(1) is sooner or later someone will assign a 'T' or an 'F' or maybe the char '1' or '0'. I've even seen bugs in .NET where middle tier code in C# compares 'Y' to 'y' (that someone accidently put in the database) and returns false when they should have returned true. Sure you can force the strings to upper or lower case or do a case insenstive compare, but that adds overhead.
If a programmer worked for me that insisted on using the CHAR(1) instead of a BIT he/she would be looking for a new job.