首頁 > 專家說

gridview 字體顏色怎么改?

來源:新能源網(wǎng)
時間:2024-08-17 13:29:01
熱度:

gridview 字體顏色怎么改?【專家解說】:protected void GridView1_RowDataBound(object sender, GridViewRowEv

【專家解說】:protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { string str = e.Row.Cells[0].Text; //Cells[0]為第一列 if (str== "未接收") { e.Row.Cells[0].BackColor = System.Drawing.Color.Red; } //查找關(guān)鍵字 if (str.Contains("keyName")) { string newStr = "<font color=red>" + str + "</font>"; e.Row.Cells[0].Text = str.Replace("班keyName", newStr); } } } 這給你懶的!我是復(fù)制我自己的代碼 當(dāng)然有的地方稍微有點(diǎn)不同 你自己看看 應(yīng)該很容易解決 因?yàn)槲铱梢赃\(yùn)行 就是 數(shù)字改改 名字改改!