protected void Page_Load()
    {
        DataTable newdtb = new DataTable();
        newdtb.Columns.Add("Id", typeof(int));
        newdtb.Columns.Add("ProName", typeof(string));
        newdtb.Columns.Add("ProPrice", typeof(decimal));
        newdtb.Columns["Id"].AutoIncrement = true;

for (int i = 1; i < 11; i++)
        {
            DataRow newRow = newdtb.NewRow();
            newRow["ProName"] = "pro" + i.ToString();
            newRow["ProPrice"] = 12.3m;
            newdtb.Rows.Add(newRow);       
        }
        GridView1.DataSource = newdtb;
        GridView1.DataBind();
    }

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-29
  • 2021-08-28
  • 2021-07-19
猜你喜欢
  • 2022-12-23
  • 2021-06-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-03
相关资源
相似解决方案