96
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { e.Row.Attributes.Add("style", "cursor:help;"); if (e.Row.RowType == DataControlRowType.DataRow && e.Row.RowState == DataControlRowState.Alternate) { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='orange'"); e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='#E56E94'"); e.Row.BackColor = Color.FromName("#E56E94"); } } else { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='orange'"); e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='gray'"); e.Row.BackColor = Color.FromName("gray"); } } }
88
protected void DrugGridView_RowDataBound(object sender, GridViewRowEventArgs e) { // To check condition on integer value if (Convert.ToInt16(DataBinder.Eval(e.Row.DataItem, "Dosage")) == 50) { e.Row.BackColor = System.Drawing.Color.Cyan; } }
78
//Check if it is not header or footer row if (e.Row.RowType == DataControlRowType.DataRow) { //Check your condition here If(Condition True) { e.Row.BackColor = Drawing.Color.Red // This will make row back color red } }
67
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.Cells[8].Text.Equals("TextToMatch")) { e.Row.BackColor = System.Drawing.Color.DarkRed; e.Row.ForeColor = System.Drawing.Color.White; } }
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.Cells[8].Text.Equals("TextToMatch")) { e.Row.Attributes.CssStyle.Value = "background-color: DarkRed; color: White"; } }
57
protected void GridView_TimeTable_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { if (e.Row.RowType == DataControlRowType.DataRow) { var tt = (TimetableModel)(e.Row.DataItem); if (tt.Unpublsihed ) e.Row.BackColor = System.Drawing.Color.Red; else e.Row.BackColor = System.Drawing.Color.Green; } } }