The following method is used to fix the gridview header during the project process.
<Script language = "JavaScript">
Function Init ()
{
VaR tbbody = Document. getelementbyid ("<% = gridview2.clientid %> ");
If (tbbody! = NULL)
{
VaR tbhead = tbbody. clonenode (true)
For (I = tbhead. Rows. Length-1; I> 1; I --)
Tbhead. deleterow (I );
Divcontent. appendchild (tbhead );
}
}
Window. onload = init
</SCRIPT>
<Div id = "divcontent">
</Div>
<Div id = "divg" style = "height: 180px; position: relative; overflow: Scroll;">
<Asp: gridview id = "gridview1" runat = "server" onrowcreated = "gridviewjavasonrowcreated" allowpaging = "true" pagesize = "15"
Autogeneratecolumns = "false" width = "800" showheader = "false" onrowdatabound = "gridview1_rowdatabound" datakeynames = "xtbh">
<Alternatingrowstyle cssclass = "alternatingback"> </alternatingrowstyle>
<Rowstyle cssclass = "griditem"> </rowstyle>
<Headerstyle backcolor = "# ceddf0" forecolor = "#000000" Height = "26px"/>
<Columns>
<Asp: boundfield headertext = "enterprise name" datafield = "Organization"/>
<Asp: templatefield>
<Itemtemplate>
<% # Databinder. eval (container. dataitem, "xtbh"). tostring (). Trim () = "0 "? "" + Databinder. eval (container. dataitem, "mingc") + "": "<a href =/" #/"onclick =/" window. open ('.. /project /#. aspx? Xtbh = "+ databinder. eval (container. dataitem, "xtbh") + "','', 'toolbar = No, scrollbars = Yes')/">" + databinder. eval (container. dataitem, "mingc") + "</a>"
%>
</Itemtemplate>
</ASP: templatefield>
<Asp: boundfield datafield = "zjf" headertext = "Total (10 thousand)"/>
<Asp: boundfield datafield = "daik" headertext = "loan (10 thousand)"/>
<Asp: boundfield datafield = "gdzc" headertext = "fixed asset investment"/>
<Asp: boundfield datafield = "yongh" headertext = "(10 thousand)"/>
</Columns>
<Pagersettings visible = "false"/>
<Emptydatatemplate>
<Tr class = "gridheader" style = "font-size: 10pt;">
<TH rowspan = "2"> company name </Th> <TH rowspan = "2"> project name </Th> <TH colspan = "4"> total investment </Th> </tr> <tr class = "gridheader" style = "font-size: 10pt; "> </Th> <TH> total amount () </Th> <TH> loans) </Th> <TH> fixed asset investment (10 thousand) </Th> <TH> among them, Foreign Exchange (10 thousand) </Th>
</Tr>
</Emptydatatemplate>
<Emptydatarowstyle cssclass = "gridheader"/>
</ASP: gridview>
</Div>
<Div id = "div2" style = "visibility: hidden; Height: 180;">
<Asp: gridview id = "gridview2" runat = "server" onrowcreated = "gridview2_onrowcreated" allowpaging = "true" pagesize = "1"
Autogeneratecolumns = "false" width = "800" onrowdatabound = "gridview2_rowdatabound" datakeynames = "xtbh">
<Alternatingrowstyle cssclass = "alternatingback"> </alternatingrowstyle>
<Rowstyle cssclass = "griditem"> </rowstyle>
<Headerstyle backcolor = "# ceddf0" forecolor = "#000000" Height = "26px"/>
<Columns>
<Asp: boundfield headertext = "enterprise name" datafield = "Organization"/>
<Asp: templatefield>
<Itemtemplate>
<% # Databinder. eval (container. dataitem, "xtbh"). tostring (). Trim () = "0 "? "" + Databinder. eval (container. dataitem, "mingc") + "": "<a href =/" #/"onclick =/" window. open ('.. /project /#. aspx? Xtbh = "+ databinder. eval (container. dataitem, "xtbh") + "','', 'toolbar = No, scrollbars = Yes')/">" + databinder. eval (container. dataitem, "mingc") + "</a>"
%>
</Itemtemplate>
</ASP: templatefield>
<Asp: boundfield datafield = "zjf" headertext = "Total (10 thousand)"/>
<Asp: boundfield datafield = "daik" headertext = "loan (10 thousand)"/>
<Asp: boundfield datafield = "gdzc" headertext = "investment"/>
<Asp: boundfield datafield = "yongh" headertext = ""/>
</Columns>
<Pagersettings visible = "false"/>
</ASP: gridview>
</Div>