DataGrid display picture and modify color in .NET

xiaoxiao2021-03-06  37

Here is two tips using DataGrid.

1. How to change the color of a certain in DataGrid

Private void DGD_Data_itemdatabase (Object sender, system.web.ui.webcontrols.dataGriditemeventArgs e) {if (E.Item.cells [0] .Text.trim (). Equals ("aw") {E.Item.cells [ 0]. Backcolor = system.drawing.color.red;}}

2. Modify the color when the mouse is placed on a certain

private void dgd_data_ItemDataBound (object sender, System.Web.UI.WebControls.DataGridItemEventArgs e) {e.Item.Cells [0] .Attributes.Add ( "onmouseover", "this.style.backgroundColor = '# DDEEFF'"); }

III. How to display pictures in DataGrid

转载请注明原文地址:https://www.9cbs.com/read-116299.html

New Post(0)