I had datalist and My manager told me when user select item in datalist this item must have css or color .I did my code but it didnot work well and this error apeared ( Operator == cannot be applied to operands of type System.Web.UI.WebControls.ListItemType and System.Web.UI.WebControls.DataControlRowType )
protected void DataList3_ItemDataBound(object sender, DataListItemEventArgs e)
{
{
if (e.Item.ItemType == DataControlRowType.DataRow)
{
e.Item.Attributes["onmouseover"] = "this.style.cursor='hand';this.style.textDecoration='underline';";
e.Item.Attributes["onmouseout"] = "this.style.textDecoration='none';";
e.Item.Attributes["onclick"] = ClientScript.GetPostBackClientHyperlink(this.DataList3, "Select$" + e.Item.ItemIndex);
}
}
}
e.Itemis aDataListItem; if you check its ItemType property, you’ll see that it’s a ListItemType, so you should use that enumeration.http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.listitemtype.aspx
Something like: