I have a listview that is loaded with a list of objects that contain an attribute called AssigneeView which holds the date that the entry was opened. The listview's ItemTemplate has a label named “lblHeader”. What I want to do is loop through the ListView.Items and check each element’s AssigneeView attribute, if it is null, I want to set the lblHeader.Text to be bold (indicating it is unread).
I want to create a method that takes an attribute from the Object in the Items list called ticketID and lookup whether or not the AssigneeView field is null for that field and return a bool. So it would look something like
ForEach item in listview.Items
if(IsUnread(item.datamember.ticketID)) then
item.lblHeader.MakeBold
else
item.lblHeader.MakeNotBold
I’m not 100% on how to dig into the telerik control to get what I need to do this. Any suggestions?
UPDATE:
here’s where I am at the moment:
using (var client = new QUTIService.QSVCClient())
{
var data = client.SearchTickets(this.myGuid, txtSearchString.Text, 100, chkSearchClosed.Checked).ToList();
lsvResultTickets.DataSource = data;
lsvResultTickets.DataBind();
if (data.Count == 0)
{
lblStatus.Text = "No tickets found.";
}
else
{
foreach (var item in lsvResultTickets.Items)
{
var obj = item.DataItem as QT.FullTicket;
if (TicketIsUnread(obj.OriginalTicket.TicketID))
{
//???
}
}
}
}
Ok, it turns out that I just had to drill down one more level. I didn’t need to pull out another method to do the check for me. I handled this is in the item loaded event handler, here’s what I ended up with: