lorena
Centurion
I have several functions common to almost all of the pages in my web application.
According to what I have read (and this is the first time I have tried to do this), I should be able to create a class that contains the function(s) and access it from within my code (either code-behind or .aspx)
Here is the class code:
and I am using it to display dates in the ItemTemplate of a datagrid. I tried two different ways:
(just displays blank field - no error but no date either)
And this way:
Which gives me this error:BC30451: Name 'mreqFunctions' is not declared
What do I need to do to declare the function? I am using VS 2003.
I am really confused and would appreciate any help
According to what I have read (and this is the first time I have tried to do this), I should be able to create a class that contains the function(s) and access it from within my code (either code-behind or .aspx)
Here is the class code:
Visual Basic:
Public Class mreqFunctions
Public Shared Function showShortDate(ByVal aDate As Object)
If Not IsDBNull(aDate) Then
Return aDate.ToShortDateString
End If
End Function
End Class
Visual Basic:
<ItemTemplate>
<asp:Label ID="lblReqCompDate" Runat="server" text='<%=mreqFunctions.showShortDate(DataBinder.Eval(Container.DataItem,"requested_comp_date")) %>' />
</ItemTemplate>
And this way:
Visual Basic:
<ItemTemplate>
<asp:Label ID="lblReqCompDate" Runat="server" text='<%#mreqFunctions.showShortDate(DataBinder.Eval(Container.DataItem,"requested_comp_date")) %>' />
</ItemTemplate>
What do I need to do to declare the function? I am using VS 2003.
I am really confused and would appreciate any help