|
Posted Tuesday, January 24, 2006
|
So I am working with this whole .NET 2.0 stuff and trying to recreate my movie site in it. I run into the a problem with the DataView control because I want to manipulate some data and display different results. Well I figured out how to get it going but I feel that the way it has to be done is
DUMB!
For some reason it doesn't let you use databound controls with If-Else statements, instead I have to create a method in my code behind to spit out another object. Like so:
Public Function ShowQuality(ByVal Quality As Integer) As String
If IsNothing(Quality) Or Quality = 0 Then
Return "Unknown"
Else
Return "<img src='images/stars/" & Quality & ".gif' />"
End If
End Function
And in my aspx page I then say:
<%# ShowQuality(Eval("Quality"))%>
To me this is pretty stupid! The code behind is for CODE. The aspx page is for text/HTML (ie. DISPLAY). So having a code behind page spit html is dumb. I'm sure this is one of the many things that will piss me off about 2.0 so lets keep count. There are a lot of really cool things but it will be more fun this way.
.NET 2.0
DUMB pts = 1