123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Linq;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- public partial class _Default : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- DataTable dt = testTable();
- List<string> colPerWidth=new List<string>();
- for (int i = 0; i < 10; i++)
- {
- colPerWidth.Add("150");
- }
- ScrollerTable table = new ScrollerTable();
- string html= table.GetScrollerTable(dt,1, colPerWidth,1000,600);
- divTable.InnerHtml = html;
- }
- private DataTable testTable()
- {
- int colsCount = 10;
- int rowsCount = 40;
- DataTable dt =new DataTable();
- for (int i = 0; i < colsCount; i++)
- {
- dt.Columns.Add("表头" + i);
- }
- for (int i = 0; i < rowsCount; i++)
- {
- DataRow row = dt.NewRow();
- for (int j = 0; j < colsCount; j++)
- {
- row[j] = "第"+i+"行,内容" + j;
- }
- dt.Rows.Add(row);
- }
- return dt;
- }
- }
|