把這個屬性脩改城這個AutoGenerateColumns="False"

解决方案 »

  1.   

    你直接把数据源就是DataTable的列名改为中文的不救可以了吗?
      

  2.   

    To shenanigan(宝宝):
    那我该怎么设置中文名呢?To reformer((问自己最不懂的问题)):
    我不能改成中文,因为代码中很多地方都得改到了。
      

  3.   

    this.dgInputBuffer.TableStyles.Clear();
    DataGridTableStyle ts = new DataGridTableStyle();
    ts.MappingName = "Customers";DataGridTextBoxColumn col1 = new DataGridTextBox();
    col1.HeaderText = "ISBN";
    col1.MappingName = "ISBN";DataGridTextBoxColumn col2 = new DataGridTextBox();
    col2.HeaderText = "书名";
    col2.MappingName = "Name";...ts.GridColumnStyles.AddRange(new DataGridColumnStyle[]{col1, col2, ...});this.dgInputBuffer.TableStyles.Add(ts);this.dgInputBuffer.SetDataBinding(this.customerTable, "");
      

  4.   

    稍有点出入,但给分的。 DataGridTableStyle ts = new DataGridTableStyle(); this.dgInputBuffer.TableStyles.Clear();
    ts.MappingName = "Customers"; DataGridTextBoxColumn col1 = new DataGridTextBoxColumn();
    col1.HeaderText = "ISBN";
    col1.MappingName = "ISBN"; DataGridTextBoxColumn col2 = new DataGridTextBoxColumn();
    col2.HeaderText = "书名";
    col2.MappingName = "Name"; DataGridTextBoxColumn col3 = new DataGridTextBoxColumn();
    col3.HeaderText = "出版社";
    col3.MappingName = "Publisher";

    DataGridTextBoxColumn col4 = new DataGridTextBoxColumn();
    col4.HeaderText = "作者";
    col4.MappingName = "Author"; DataGridTextBoxColumn col5 = new DataGridTextBoxColumn();
    col5.HeaderText = "一级编号";
    col5.MappingName = "Index1"; DataGridTextBoxColumn col6 = new DataGridTextBoxColumn();
    col6.HeaderText = "二级编号";
    col6.MappingName = "Index2"; DataGridTextBoxColumn col7 = new DataGridTextBoxColumn();
    col7.HeaderText = "价格";
    col7.MappingName = "Price"; DataGridTextBoxColumn col8 = new DataGridTextBoxColumn();
    col8.HeaderText = "入库数量";
    col8.MappingName = "Number"; ts.GridColumnStyles.AddRange(new DataGridColumnStyle[]{col1, col2, col3, col4, col5, col6, col7, col8});
    this.dgInputBuffer.TableStyles.Add(ts); this.dgInputBuffer.SetDataBinding(this.customerTable, ""); this.dgInputBuffer.DataSource = new DataView(this.customerTable);