Hi,
I have read many post obout n-layer programming, but still have found no good example or reply on some fundamental issues that I have.
I use 3 tier (Dal, BLL, Pll) and for some gridview I want to present the following in one column:
the fields period 1, period 2, period 3, period 4 and period 5 (all boolean) but only if the value is true. I retrieve all data from a (ms Sql) database. The following code I added to the aspx-file, to create a string that will give me only the periods that are true (it works):
Public Function perioden(ByVal rst As SVS.POsRow) As String
Dim p As String = ":"
If rst.per1 Then p += "1"
If rst.per2 Then p += " 2"
If rst.per3 Then p += " 3"
If rst.per4 Then p += " 4"
If rst.per5 Then p += " 5"
If p.Length > 3 Then
p = p.Replace(" ", " - ")
End If
Return p
End Function
So the result can be: ":1-3-4"
In my gridview I added a label (in itemtemplate ) with the following code:
<asp:Label ID="label_p" runat="server" Text="<%# perioden(ctype(ctype(container.dataitem, system.data.datarowview).row, svs.posrow)) %>">
This also works fine. But, now I want to call this function 'perioden' not only in this aspx-file but in my whole webapplication. I tried to create a class with this public function , I get an error that the function isn't found.
So, do I put all this kind of presentation layout code in the aspxfiles (PLL) or cal I somehow more this to a class that can be accessed from all pages?