Text='<%# Convert.IoInt32(Eval("Tb_isread"))==0?"未读":"已读"%>'
我想要把“未读”显示为红色  ^_^

解决方案 »

  1.   

    <font color="red">字体</font>
      

  2.   


    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            Label lbl = (Label)e.Row.Cells[x].Controls[y];          
            if(lbl.text=="未读")
            {
              e.Row.Cells[x].Style.Add("cursor", "pointer");
            }
     }
      

  3.   

    Text=' <%# Convert.IoInt32(Eval("Tb_isread"))==0?"<font color="red">未读</font>":"已读"%>' 
     不行啊!出错了
      

  4.   

    能不能在源中用HTML控制啊??
      

  5.   

    <%# Convert.IoInt32(Eval("Tb_isread")) == 0 ? "<font color=red>" + "未读" + "</font>" : "已读"%> 
      

  6.   

    Text=' <%# Convert.IoInt32(Eval("Tb_isread"))==0?" <font color=\"red\">未读 </font>":"已读"%>'
    这样也行
    LZ的头像很搞笑啊。。哈哈哈.............. 
      

  7.   

    Text=' <%# Convert.IoInt32(Eval("Tb_isread"))==0?"<font color=red>未读</font>":"已读"%>'
      

  8.   

    注意 ‘和区别“Text='<%# Convert.IoInt32(Eval("Tb_isread"))==0?" <font color='red'>未读 </font>":"已读"%>' 
      

  9.   

    Text=' <%# Convert.IoInt32(Eval("Tb_isread"))==0?" <font color=red>未读 </font>":"已读"%>' 
    这样行还有下面也可以
    不过还得遍历如果这个是在加载时运行的也可以这样
      

  10.   


    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            
            if(e.row.cell[0].text=="未读")
            {
             e.row.cell[0].text="<font color=red>未读</font>";
            }
     }