DataGrid关键字变色
原文发布时间为:2009-05-01 —— 来源于本人的百度文章 [由搬家工具导入]
private void DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e){
if(e.Item.ItemIndex>-1)
{
string tmp = "关键字";
foreach(TableCell cell in e.Item.Cells)
cell.Text = cell.Text.Replace(tmp,"<font color='red'>"+tmp+"</font>");
}
}