<ItemTemplate>
<%#
  if(DataBinder.Eval(Container.DataItem, "news_status")==true)
  {Response.Write("已审核");}
  else
  {Response.Write("未审核");}
%>
</ItemTemplate>那要怎样才有效呢?

解决方案 »

  1.   

    在<%# %>中不能使用程序语句吧,看看MSDN帮助
      

  2.   

    <ItemTemplate>
    <asp:label id=Label5 runat="server" Text='<%#ChangStatushybv8((DataBinder.Eval(Container.DataItem, "news_status")).ToString())%>'>
    </asp:label>
    </ItemTemplate>在模板列里放个LABEL标签 调用后台这个方法 /// <summary>
    /// 设置自定义文本值
    /// </summary>
    /// <param name="hy21">是否是优惠用户</param>
    /// <returns>返回自定义文本</returns>
    protected string ChangStatushy21(string hy21)
    {
    if(hy21 == "1")
    {
    return "已审核";
    }
    else if(hy21 == "0")
    {
    return "<font color=red>未审核</font>";
    }
    else
    {
    return "";
    }
    }
      

  3.   

    private void Data_Load()
        {
            string strConn = "Provider=Microsoft.Jet.Oledb.4.0;Data Source=" + Server.MapPath("../"+System.Configuration.ConfigurationManager.AppSettings["MyData"]);
            string Sql = "SELECT news_id,news_title,news_author,news_status,news_flag,news_time FROM news ORDER BY news_id DESC";
            OleDbConnection Conn = new OleDbConnection(strConn);
            OleDbDataAdapter myDataAdapter = new OleDbDataAdapter(Sql, Conn);
            Conn.Open();
            //填充数据库
            myDataAdapter.Fill(myDS);
            //绑定记录集
            myDataGrid.DataSource = myDS;
            myDataGrid.DataBind();
        }我这种情况怎么搞啊,麻烦大伙了
      

  4.   

    SELECT news_id,news_title,news_author,
    CASE news_status when 1 then "已审核"
    when 0 then "未审核"
    ,news_flag,news_time 
    FROM news ORDER 
      

  5.   

    <%#Convert.ToBoolean(DataBinder.Eval(Container.DataItem, "news_status"))?"已审核":"未审核"%>或者:
      1。先在cs中寫函數
         protected string GetVerifyStr(string orgStr)
        {
             string ret="";
            if(Convert.ToBoolean(DataBinder.Eval(Container.DataItem, "news_status")))
            {
              ret="已审核";
            }
            else
           {
            ret="未审核";
            }
             return ret;
         }然後在客戶端調用這個函數。<%#GetVerifyStr(DataBinder.Eval(Container.DataItem, "news_status").ToString())%>