Hi,
I have the following code in .aspx page
Code:
<ItemTemplate>
<% if i = 1 then
i = 2
else
i = 1
end if
%>
<tr>
<td class="content<%=i.toString()%>">
<p>
<a href="EToolTrivia.aspx?topic_id=<%#Container.DataItem("topic_name")%>" class="toplink"><%#Container.DataItem("topic_name")%></a></p>
</td>
<td class="content<%=i.toString()%>">
<p>
<%#Container.DataItem("Last_Login")%>
</p>
</td>
<td class="content<%=i.toString()%>">
<p>
<%# DisplayValue(Container.dataitem)%>
</p>
</td>
<td class="content<%=i.toString()%>">
<p>
<a href="EQuiz.aspx" class="toplink"><%#Container.DataItem("Quiz_Status")%></a></p>
</td>
<td class="content<%=i.toString()%>">
<p>
<%#Container.DataItem("Quiz_Score")%>
</p>
</td>
</tr>
</ItemTemplate>
I have the following code behind
Code:
Public Class EHomePage
Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Protected WithEvents customers As System.Web.UI.WebControls.Repeater
'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
End Sub
Function DisplayValue(dataitem as object)
if dataitem("time_spent") = "" then
return ""
else return (dataitem("time_spent")) & " min"
end if
End Function
End Class
Now when I run my .aspx page, I get the following error
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30451: Name 'DisplayValue' is not declared.
Source Error:
Line 117: <td class="content<%=i.toString()%>">
Line 118: <p>
Line 119: <%# DisplayValue(Container.dataitem)%>
Line 120: </p>
Line 121: </td>
Source File:
http://localhost/ELearning/EHomePage.aspx Line: 119
How do I get the displayValue function to work?
Basically I am just trying to hide the records if they are null in my database. Is there any other way to do this?