国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

Ext.Net動態加載多表頭

2019-11-17 01:44:01
字體:
來源:轉載
供稿:網友

Ext.Net動態加載多表頭

效果展示如下:

aspx頁面代碼:

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" Tagxmlns="http://www.w3.org/1999/xhtml"><head id="Head1" runat="server"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /> <title>數據展示(版本3)</title></head><body> <form id="form1" runat="server"> <ext:ResourceManager ID="ResourceManager1" runat="server" /> <ext:GridPanel ID="gpList" runat="server" Title="" IconCls="icon-grid" AnimCollapse="false" Collapsible="true" SortableColumns="true" AutoHeight="true" Width="3000"> <Store> <ext:Store ID="StoreAll" runat="server" OnRefreshData="MyData_Refresh"> <Model> <ext:Model ID="Model1" runat="server"> <Fields> </Fields> </ext:Model> </Model> </ext:Store> </Store> <ColumnModel ID="ColumnModel1" runat="server"> <Columns> </Columns> </ColumnModel> <SelectionModel> <ext:RowSelectionModel ID="RowSelectionModel1" runat="server" PruneRemoved="false" Mode="Multi" /> </SelectionModel> </ext:GridPanel> </form></body></html>

aspx.cs文件代碼:

if (!IsPostBack){  //清除舊數據與記錄集this.StoreAll.Reader.Clear(); this.gpList.SelectionModel.Clear();this.gpList.ColumnModel.Columns.Clear();this.StoreAll.Model.Clear();

  DataTable dtProject = new PerforBLL().GetData();//從數據庫中讀取的數據

  //數據源DataTable results = new DataTable();results.Columns.Add("Name");

  //數據集Store  Model extModel = new Model();  extModel.Fields.Add(new ModelField("Name", ModelFieldType.String));    //顯示的列數據  List<ColumnBase> extColumnBaseList = new List<ColumnBase>();  extColumnBaseList.Add(new RowNumbererColumn() { ID = "RowNumbererColumn1", Width = 25 });  extColumnBaseList.Add(new Column() { ID = "cName", Text = "名稱", Width = 300, DataIndex = "Name" });

  Column wZJ= new Column() { ID = "cWHZ", Text = "匯總" };

  extModel.Fields.Add(new ModelField("W-T", ModelFieldType.Float));extModel.Fields.Add(new ModelField("W-P", ModelFieldType.Float));

if (!results.Columns.Contains("W-T")) results.Columns.Add("W-T");if (!results.Columns.Contains("W-P")) results.Columns.Add("W-P");

wZJ.Columns.Add(new Column(){  Text = "時間",Width = 50,DataIndex = "W-T",Sortable = true});wZJ.Columns.Add(new Column(){  Text = "成本",Width = 50,DataIndex = "W-P",Sortable = true  });

  extColumnBaseList.Add(wZJ);

  //動態給數據

  foreach (DataRow drProject in dtProject.Rows){    DataRow dr = results.NewRow();dr["Name"] = drProject["Name"];    dr["W-T"]= 0;dr["W-P"] = 0;

    results.Rows.Add(dr);

  }

  this.StoreAll.Model.Add(extModel);this.gpList.ColumnModel.Columns.AddRange(extColumnBaseList);this.StoreAll.DataSource = results;this.StoreAll.DataBind();this.gpList.Render();

}


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 股票| 越西县| 河北区| 金溪县| 汉川市| 手机| 遵义市| 通道| 永安市| 紫阳县| 和静县| 屯留县| 麻城市| 龙岩市| 兰州市| 江津市| 东方市| 贵德县| 德州市| 淮北市| 宁乡县| 潞西市| 平武县| 绥化市| 穆棱市| 文安县| 绵阳市| 黑水县| 栾川县| 扎兰屯市| 鹤壁市| 滨州市| 南郑县| 班戈县| 阿瓦提县| 莎车县| 鸡东县| 进贤县| 普宁市| 烟台市| 卓尼县|