protected void GvLpDpDetail_RowDataBound1(object sender, GridViewRowEventArgs e) { objdb = new DB(); if (e.Row.RowType == DataControlRowType.DataRow) { string StrQ = "select DP.Ref_No,DP.Category_Name,DP.Appointed_By1,DP.Total_Qty,DP.DP1_Name,DP.DP1_SailingDate,LP.Vessel_Name,LP.Total_Lp_Qty,LP.LP1_Name,LP.Load_Sailing from Discharge_Port as DP inner join Load_Port as LP on DP.Ref_No =LP.Ref_No where DATEDIFF(Day,DP.ETA,GETDATE())>'12' and DP.DP1_ArrivalDate is null"; ds = objdb.getdata(StrQ); GvLpDpDetail.DataSource = ds; GvLpDpDetail.DataBind(); DataRowView drv=(DataRowView)e.Row.DataItem; for (int i = 0; i < drv.DataView.Table.Columns.Count;i++ ) { e.Row.ForeColor = System.Drawing.Color.Red; if((int)DataBinder.Eval(e.Row.DataItem,'"+ds+"')) { } } } }
Datagridview.row[0].DefaultCellStyle.color = color.Blue;
GridView1.Rows[1].Cells[1].BackColor = System.Drawing.Color.Red; protected void GridView2_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow ) { if (e.Row.Cells[1].Text == "1") { e.Row.Cells[1].BackColor = Color.Red; } } }
dataGridView1.FirstDisplayedScrollingRowIndex = dataGridView1.Rows.Count - 1;
dataGridView1.Rows[2].DefaultCellStyle.BackColor = Color.Yellow;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)