Hello,
I have a listview that has shows a startdate enddate starttime endtime. I want to have it only display startdate unless the enddate is not equal to the startdate. For example is the row had a startdate & enddata that were the same I would like for the enddate to be set as visable = false. I have tried the code below but cant seem to get it to work, any help would be great.
Thanks
<ItemTemplate> <li class="rlvI"> <asp:Label ID="SubjectLabel" runat="server" Text='<%# Eval("Subject") %>' /> <asp:Label ID="DescriptionLabel" runat="server" Text='<%# Eval("Description") %>' /> <asp:Label ID="StartDateLabel" runat="server" Text='<%# Eval("StartDate", "{0:MMMM dd}") %>' /> <asp:Label ID="EndDateLabel" runat="server" Text='<%# Eval("EndDate", "{0:MMMM dd}") %>' /> <asp:Label ID="StartTimeLabel" runat="server" Text='<%# Eval("StartTime","{0:t}") %>' /> <asp:Label ID="EndTimeLabel" runat="server" Text='<%# Eval("EndTime","{0:t}") %>' /> </li> </ItemTemplate>{
if (e.Item is ListViewDataItem)
{
ListViewDataItem item = e.Item as ListViewDataItem;
int lbstart = (int)DataBinder.Eval(item.DataItem, "StartDateLabel");
int lbend = (int)DataBinder.Eval(item.DataItem, "EndDateLabel");
if (lbstart == lbend)
{
item.Visible = false;
}
}