就是datagrid列表中有一列是金额列,我想将这一列显示加上千分位
如:
原显示:1234
现为:1,234 (加千分位后)

解决方案 »

  1.   

    datagrid在绑定后显示内容是可以随便修改的。你可以用程序修改成你想显示的方式吗。
      

  2.   

    Dim myNfi As New System.Globalization.NumberFormatInfo
            Dim shu As Integer        TextBox2.Text = "2222"
            shu = CInt(TextBox2.Text)
            TextBox2.Text = shu.ToString("N0", myNfi)
      

  3.   

    AllReporterDataGrid.DataSource = reporter.DataViewOfAllReporter;
    AllReporterDataGrid.DataBind();
    for(int i=0;i<AllReporterDataGrid.Items.Count;i++)
    {
    int type = int.Parse(this.AllReporterDataGrid.Items[i].Cells[6].Text);
    if(type==1)
    {
    this.AllReporterDataGrid.Items[i].Cells[6].Text="是";
    }
    else
    {
    this.AllReporterDataGrid.Items[i].Cells[6].Text="否";
    }
    }
      

  4.   

    System.Globalization.NumberFormatInfo myNfi = new System.Globalization.NumberFormatInfo(); 
    int shu; 
    TextBox2.Text = "2222"; 
    shu = System.Convert.ToInt32(TextBox2.Text); 
    TextBox2.Text = shu.ToString("N0", myNfi);
      

  5.   

    shu.ToString("N0", myNfi);是N和零
    N0
      

  6.   

    int st = 123456789;
    Page.Response.Write(st.ToString("N"));
      

  7.   

    int st = 123456789;
    Page.Response.Write(st.ToString("N0"));
      

  8.   

    难道我要再一个一个的去for替换??
    哪样也太慢啦吧
    应该有一个可以直接设置格式的
    datagrid属性里有一个数据格式设置表达式
    但就是不知怎么写???
      

  9.   

    在ItemDataBound事件里写
    if(e.Item.ItemType==ListItemType.Item||e.Item.ItemType==ListItemType.AlternatingItem)
    {
    e.Item.Cells[1].Text==(Convert.ToDouble(e.Item.Cells[1].Text)).ToString("#,###");
    }
      

  10.   

    在datagrid属性生成器"列"中对应字段的"数据格式设置表达式"填入:{0:N}
      

  11.   

    在DataGrid属性生成器里,那个列的数据格式设置表达式里加{0:C}可以转换为货币类型,
    或者用ToString("c")
      

  12.   

    好好
    谢谢大家welshem(天堂客) ( ) 信誉:100  2004-12-29 14:21:00  得分: 0  
     
     
       在datagrid属性生成器"列"中对应字段的"数据格式设置表达式"填入:{0:N}
      
     
    Top  
     
     回复人: junstyle(风样男子—现在专攻C#) ( ) 信誉:100  
    正确
      

  13.   

    哪么要是页脚里有一个小计也要分开哪怎么办呀??
    用e.Item.Cells[1].Text==(Convert.ToDouble(e.Item.Cells[1].Text)).ToString("#,###");
    这种方法,如果是3333转换是正确的,但要是8888.333它就不能正角转换啦。