Ext.net dynamic loading of multiple headers

Source: Internet
Author: User

The results are shown below:

ASPX page code:

<%@ Register assembly= "ext.net" namespace= "ext.net" tagprefix= "Ext"%>
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<meta http-equiv= "x-ua-compatible" content= "Ie=emulateie7"/>
<title> data show (version 3) </title>
<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= "" ">
<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>

Aspx.cs File Code:

if (! IsPostBack)
{
Clean up old data and record sets
This. StoreAll.Reader.Clear ();
This.gpList.SelectionModel.Clear ();
This.gpList.ColumnModel.Columns.Clear ();
This. StoreAll.Model.Clear ();

DataTable dtproject = new Perforbll (). GetData ();//data read from the database

Data source
DataTable results = new DataTable ();
Results. Columns.Add ("Name");

Data set Store
Model Extmodel = new Model ();
EXTMODEL.FIELDS.ADD (New Modelfield ("Name", modelfieldtype.string));
  
Column data that is displayed
list<columnbase> extcolumnbaselist = new list<columnbase> ();
Extcolumnbaselist.add (New Rownumberercolumn () {ID = "RowNumbererColumn1", Width = 25});
Extcolumnbaselist.add (New Column () {ID = "CName", Text = "Name", Width = +, Dataindex = "Name"});

Column wzj= new column () {ID = "cwhz", Text = "Total"};

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 = "Time",
              width =,
              dataindex = "W-t",
              sortable = True
       });
       wzj.columns.add (New Column ()
        {
        Text = Cost,
              width =,
              dataindex = "W-p",
              sortable = True
});

Extcolumnbaselist.add (WZJ);

Dynamic to Data

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 ();

}

Ext.net dynamic loading of multiple headers

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.