如我数据库一列里面记录的信息是1.2.3.4......
但是我想如果是1就输出中国,2就输出美国......如此类推
我想应该在模板列中做,但请问具体应该怎么做 ?谢谢

解决方案 »

  1.   

    在查询的时候就可以控制了:
    select SendID,UserID,ClientName,
    case Status
    when '1'then '中国'
    when '2' then '美国'
    end as Status,
    SendTime
    from Send
    where UserID=@userid
      

  2.   

    这样 如何绑定到DataGird??谢谢我是小单,asp.net的菜菜,希望大家能多帮忙
      

  3.   

    假设你绑定的是DataTable,列名是country
    <%# CountryEnum[ (int) ((System.Data.DataRowView) Container.DataItem)["country"] ] %>在你的cs文件里面定义:
    protected static string[] CountryEnum = new string[]{ "中国", "美国", …… };
      

  4.   

    还是不是太明白,望能明示
    谢谢
    显示控件创建错误我的绑定是这样的
    if(!this.IsPostBack)
    {
    SqlConnection con=new SqlConnection(System.Configuration.ConfigurationSettings.AppSettings["CON2"]);
    con.Open();

    SqlDataAdapter sda=new SqlDataAdapter();
    sda.SelectCommand=new SqlCommand("select top 30 name,level,money,class from Info order by level DESC",con);
    DataSet ds=new DataSet();
    sda.Fill(ds,"country");
    this.DataGrid1.DataSource=ds;
    this.DataGrid1.DataBind();
    con.Close();
    }
    其中class是我想绑定显示的,具体该怎么做 ?
      

  5.   

    要么在执行的数据提取试语名里修改列名,要么在DataGrid事件中修改列名
      

  6.   

    已经搞定了,谢谢 Ivony
    请问怎么给分的啊?我是小单,asp.net的菜菜,希望大家能多帮忙