How do I get Gridview to render THEAD?

前端 未结 8 928
鱼传尺愫
鱼传尺愫 2020-12-04 10:12

How do I get the GridView control to render the tags? I know .UseAccessibleHeaders makes it p

相关标签:
8条回答
  • 2020-12-04 10:47

    This should do it:

    gv.HeaderRow.TableSection = TableRowSection.TableHeader;
    
    0 讨论(0)
  • 2020-12-04 10:49

    Create a function and use that function in your PageLoad event like this:

    The function is:

    private void MakeGridViewPrinterFriendly(GridView gridView) {  
        if (gridView.Rows.Count > 0) {          
            gridView.UseAccessibleHeader = true;  
            gridView.HeaderRow.TableSection = TableRowSection.TableHeader;  
        }  
    } 
    

    The PageLoad event is:

    protected void Page_Load(object sender, EventArgs e) {
            if (!IsPostBack)
            {
                MakeGridViewPrinterFriendly(grddata);
            }
    }
    
    0 讨论(0)
提交回复
热议问题