In the ItemDataBound handle i set backgroud color to some items:
protected void MyDataList_ItemDataBound(object sender, DataListItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
TextBox cellTextBox = (TextBox)e.Item.FindControl("CellTextBox");
if (...)
{
e.Item.BackColor = Color.LightSkyBlue;
cellTextBox.BackColor = Color.LightSkyBlue;
}
}
}
But after postback (when DataBind for MyDataList doesn't call) color of the inner textBox is same, but color of entire item resets. What is the correct way to set the color for the entire item?