Create a gridview with multiple headers

Source: Internet
Author: User
Rowpan ---- cross-row colpan --- cross-column tablecellcollection tcheader = E. row. cells; ----- declare a header tcheader. add (newtableheadercell (); ------------ Add a cell tcheader [0]. attributes. add ("rowspan", "3"); ----- set the format of the cell. tcheader [3]. TEXT = "mes </Th> </tr> <tr>"; ------- </Th> </tr> <tr> "end ID protectedvoid gvtest_rowcreated (Object sender, gridviewroweventargs e) {# region creates a multi-header switch (E. row. rowtype) {casedatacontrolrowtype. header: // tablecellcollection tcheader = E. row. cells; tcheader. clear (); tcheader. add (newtableheadercell (); tcheader [0]. attributes. add ("rowspan", "3"); // tcheader [0]. attributes. add ("bgcolor", "green"); tcheader [0]. TEXT = "material part"; tcheader. add (newtableheadercell (); // tcheader [1]. attributes. add ("bgcolor", "# cc99ff"); tcheader [1]. attributes. add ("rowspan", "3"); // cross-row tcheader [1]. TEXT = "material"; // description tcheader. add (newtableheadercell (); // tcheader [2]. attributes. add ("bgcolor", "# cc99ff"); tcheader [2]. attributes. add ("colspan", "10"); // cross row tcheader [2]. TEXT = "TMS"; tcheader. add (newtableheadercell (); // tcheader [3]. attributes. add ("bgcolor", "#808000"); tcheader [3]. attributes. add ("colspan", "6"); // cross row // ---------------------- tcheader [3]. TEXT = "mes </Th> </tr> <tr>"; // tcheader in the second row. add (newtableheadercell (); tcheader [4]. attributes. add ("bgcolor", "#336666"); tcheader [4]. forecolor = system. drawing. color. white; tcheader [4]. attributes. add ("colspan", "7"); // cross row // ---------------------------- tcheader [4]. TEXT = "TMS wait"; tcheader. add (newtableheadercell (); tcheader [5]. attributes. add ("bgcolor", "#336666"); tcheader [5]. forecolor = system. drawing. color. white; tcheader [5]. attributes. add ("rowspan", "2"); tcheader [5]. TEXT = "TMS total"; tcheader. add (newtableheadercell (); tcheader [6]. attributes. add ("bgcolor", "#336666"); tcheader [6]. forecolor = system. drawing. color. white; tcheader [6]. attributes. add ("colspan", "2"); tcheader [6]. TEXT = "inuse"; tcheader. add (newtableheadercell (); tcheader [7]. attributes. add ("bgcolor", "#336666"); tcheader [7]. forecolor = system. drawing. color. white; tcheader [7]. attributes. add ("colspan", "3"); tcheader [7]. TEXT = "mes wait"; tcheader. add (newtableheadercell (); tcheader [8]. attributes. add ("bgcolor", "#336666"); tcheader [8]. forecolor = system. drawing. color. white; tcheader [8]. attributes. add ("rowspan", "2"); tcheader [8]. TEXT = "mes total"; tcheader. add (newtableheadercell (); tcheader [9]. attributes. add ("bgcolor", "#336666"); tcheader [9]. forecolor = system. drawing. color. white; tcheader [9]. attributes. add ("colspan", "2"); tcheader [9]. TEXT = "Operation </Th> </tr> <tr>"; // ------------------------------------------------------------------ tcheader. add (newtableheadercell (); tcheader [10]. attributes. add ("bgcolor", "#336666"); tcheader [10]. forecolor = system. drawing. color. white; tcheader [10]. TEXT = "311in"; tcheader. add (newtableheadercell (); tcheader [11]. attributes. add ("bgcolor", "#336666"); tcheader [11]. forecolor = system. drawing. color. white; tcheader [11]. TEXT = "stockin"; tcheader. add (newtableheadercell (); tcheader [12]. attributes. add ("bgcolor", "#336666"); tcheader [12]. forecolor = system. drawing. color. white; tcheader [12]. TEXT = "remain"; tcheader. add (newtableheadercell (); tcheader [13]. attributes. add ("bgcolor", "#336666"); tcheader [13]. forecolor = system. drawing. color. white; tcheader [13]. TEXT = "tune"; tcheader. add (newtableheadercell (); tcheader [14]. attributes. add ("bgcolor", "#336666"); tcheader [14]. forecolor = system. drawing. color. white; tcheader [14]. TEXT = "unmount"; tcheader. add (newtableheadercell (); tcheader [15]. attributes. add ("bgcolor", "#336666"); tcheader [15]. forecolor = system. drawing. color. white; tcheader [15]. TEXT = "unscrap"; tcheader. add (newtableheadercell (); tcheader [16]. attributes. add ("bgcolor", "#336666"); tcheader [16]. forecolor = system. drawing. color. white; tcheader [16]. TEXT = "return"; tcheader. add (newtableheadercell (); tcheader [17]. attributes. add ("bgcolor", "#336666"); tcheader [17]. forecolor = system. drawing. color. white; tcheader [17]. TEXT = "Mount"; tcheader. add (newtableheadercell (); tcheader [18]. attributes. add ("bgcolor", "#336666"); tcheader [18]. forecolor = system. drawing. color. white; tcheader [18]. TEXT = "Kit"; tcheader. add (newtableheadercell (); tcheader [19]. attributes. add ("bgcolor", "#336666"); tcheader [19]. forecolor = system. drawing. color. white; tcheader [19]. TEXT = "311in"; tcheader. add (newtableheadercell (); tcheader [20]. attributes. add ("bgcolor", "#336666"); tcheader [20]. forecolor = system. drawing. color. white; tcheader [20]. TEXT = "stock"; tcheader. add (newtableheadercell (); tcheader [21]. attributes. add ("bgcolor", "#336666"); tcheader [21]. forecolor = system. drawing. color. white; tcheader [21]. TEXT = "LOAD"; tcheader. add (newtableheadercell (); tcheader [22]. attributes. add ("bgcolor", "#336666"); tcheader [22]. forecolor = system. drawing. color. white; tcheader [22]. TEXT = "receive"; tcheader. add (newtableheadercell (); tcheader [23]. attributes. add ("bgcolor", "#336666"); tcheader [23]. forecolor = system. drawing. color. white; tcheader [23]. TEXT = "Mount/kit </Th> </tr>"; for (INT I = 0; I <18; I ++) {tcheader [I]. font. size = 12 ;}break ;}# create multiple headers in endregion}

 

Create a gridview with 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.