DataGrid header integration

zhaozj2021-02-16  83

DataGRID head as shown below

Title 1 Title 2 Subtites 1 Sub Title 2

The following codes can be implemented in .NET: Add the following code to the DataGrid's ItemCreate event.

private void DataGrid1_ItemCreated (object sender, System.Web.UI.WebControls.DataGridItemEventArgs e) {if (e.Item.ItemType == ListItemType.Header) {TableCellCollection tcl = e.Item.Cells; // get instance header elements Tcl.clear (); // Clear the original control Tcl.Add (New TableHeadercell ()); // Add Header Control TCL [0] .ROWSPAN = 2; / / Defining the number of lines of the header TCL [ 0] .text = "Title 1"; // Next line tcl.add (New TableHeadercell ()); TCL [1] .Columnspan = 2; TCL [1] .text = "Title 2 Subtites 1 Subtites 2 ";}}

转载请注明原文地址:https://www.9cbs.com/read-12575.html

New Post(0)