DataGrid绑定标题 怎么让搜索的关键字变色?没分了`` 有分在补,欢迎讨论!~

解决方案 »

  1.   

    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 colo=red>"+tmp+"</font>");
    }
    }
      

  2.   

    能否详细点啊``
    你的肯定行 
    cell.Text 是什么意思?
      

  3.   

    好像写错了吧 应该是 <font color='red'></font>
                             ~~~~~~~