Reputation: 51
I'm having trouble with asp ListView. I have [Message] Table which include status field = read or unread,
can listview provide different style to show this different such as,
if(Message.Status == "unread")
{
div background color = "yellow"
}
else if (Message.Status == "read")
{
div background color = "Grey"
}
Is this possible?
Thanks in Advance.
Upvotes: 1
Views: 289
Reputation: 51
i found somewhere in this site.. but forgot to bookmark it..
protected void ListInbox_ItemDataBound(object sender, ListViewItemEventArgs e)
{
Panel PanelMsg;
PanelMsg = (Panel)e.Item.FindControl("PanelMsg");
ListViewDataItem dataItem = (ListViewDataItem)e.Item;
string status = (string)DataBinder.Eval(dataItem.DataItem, "Status");
if (status == "unread")
{
PanelMsg.BackColor = System.Drawing.Color.Purple;
}
}
thanks to DJ Kraze for the support..
Upvotes: 1