In the application, many times you need to modify the rendering of the DataGrid after the binding, such as (1) When the data meets a certain condition, it is necessary to modify its rendering mode (2) turn the logic value (0, 1) in the database into men. To render, there are roughly two ways to achieve the above operation (1) The modified value (2) in itemDatabase has been used in the binding, and the database is used by a function, the database is http://blog.9cbs.net/loveCherry/ Archive / 2005/02/25 / 301441.aspx We have to achieve the following 2 features (1) modify the one-line base of people with age less than 30 in ItemDatabase to pink code as the following private void DataGrid1_itemDatabase (Object Sender, System.Web) .UI.WebControls.DataGridItemEventArgs e) {if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.EditItem) {if (Convert .ToinT16 (DataBinder.eval (E.Item.DataItem, "IAGE"))) <30) E.ITEM.BACKCOLOR = color.pink;}} Of course, you need to register event this.DataGrid1.itemdatabaseD = new system.Web.ui .WebControls.dataGriditeMeventHandler (this.DataGrid1_itemdatabase; (2) Take a person named "Zhu Wei", use aggravation to display the front code <% # DataBinder.eval (Container.DataItem, "VNAME")%> Modified to <% # MyFunc (Container.eval ("VNAME"))%> Background code Protected String Myfunc (Object S) {string _s; if (S.to () == "Zhu Li") _s = " " S.toString () " b> "; else _s = S.toString (); RET URN _S;} The above two functions are the roughly two methods I have said to achieve the above operations as simple. For some other related extensions, it is not detailed, for example, in accordance with a value, change some controls: If the control is the pass ((Control type) E.Item.FindControl (ID)) in the template column. Properties = value Dynamic settings; if the control is not the pass ((control type) E.Item.controls [(Control type) E.Item.controls [(Control type)) in the template column, attribute = value, dynamic settings, such as the value of other columns, according to the value of a column , All the same operation in the ItemDatabase event method, because the data is bound to be bound.