if else in datagrid item template

A

Allan Ebdrup

I'm using dotNet 2.0 and VS 2005.
I have a datagrid that I'm binding to an object data source (ODS), the
objects in the ODS have an FromDate property and an Id property.
Now I want to display a hyperling if(FromDate>DateTime.Now) and a label if
not, how do I do this the best way?
I tried to do a if else in the item template, but that doesn't work:
------------------
<%#
if(((OFiR.Recruitment.Staffing.Reporting.PositionPostingReporting)Container.DataItem).FromDate
DateTime.Now) {%>

<asp:HyperLink Target="_blank"
NavigateUrl='<%#"/CPI/V2/Apps/PositionPosting/opening.aspx?id=" + Eval("Id")
%>' Text='<%# Eval("Title") %>' runat="server"></asp:HyperLink>

<%# } else {%>

<asp:Label runat="server" Text='<%# Bind("Title") %>'
id="Label1"></asp:Label>

<%# } %>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top