2013-02-03 3 views
1

두 개의 열이있는 머리글이있는 gridview가 있고 각 페이지에 표시되도록하고 싶습니다.gridview에 두 개의 열 머리글을 인쇄하십시오.

헤더는 다음과 같은 기능에서 생성됩니다

Protected Sub grdOriginal_RowCreated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles grdOriginal.RowCreated 

    If e.Row.RowType = DataControlRowType.Header Then 

     Dim HeaderRow As GridViewRow = New GridViewRow(0, 0, DataControlRowType.Header, DataControlRowState.Insert) 
     Dim Cell_Header As TableCell = New TableCell() 
     Cell_Header = New TableCell() 
     Cell_Header.Text = "Ознака табле" 
     Cell_Header.HorizontalAlign = HorizontalAlign.Center 
     Cell_Header.Width = "150" 
     Cell_Header.RowSpan = 2 
     Cell_Header.Font.Bold = True 
     HeaderRow.Cells.Add(Cell_Header) 

     Cell_Header = New TableCell() 
     Cell_Header.Text = "Површине делова табли по процембеним разредима" 
     Cell_Header.HorizontalAlign = HorizontalAlign.Center 
     Cell_Header.Width = "370" 
     Cell_Header.Font.Bold = True 
     Cell_Header.ColumnSpan = 8 
     HeaderRow.Cells.Add(Cell_Header) 

     Cell_Header = New TableCell() 
     Cell_Header.Text = "Укупна површина табле" 
     Cell_Header.HorizontalAlign = HorizontalAlign.Center 
     Cell_Header.Width = "70" 
     Cell_Header.RowSpan = 2 
     Cell_Header.Font.Bold = True 
     HeaderRow.Cells.Add(Cell_Header) 

     Cell_Header = New TableCell() 
     Cell_Header.Text = "Укупна вредност табле" 
     Cell_Header.HorizontalAlign = HorizontalAlign.Center 
     Cell_Header.Width = "70" 
     Cell_Header.RowSpan = 2 
     Cell_Header.Font.Bold = True 
     HeaderRow.Cells.Add(Cell_Header) 

     Cell_Header = New TableCell() 
     Cell_Header.Text = "Примедба" 
     Cell_Header.HorizontalAlign = HorizontalAlign.Center 
     Cell_Header.Width = "70" 
     Cell_Header.RowSpan = 2 
     Cell_Header.Font.Bold = True 
     HeaderRow.Cells.Add(Cell_Header) 

     e.Row.Cells(0).Visible = False 
     e.Row.Cells(9).Visible = False 
     e.Row.Cells(10).Visible = False 
     e.Row.Cells(11).Visible = False 
     'e.Row.Cells(4).Visible = False 
     'e.Row.Cells(12).Visible = False 
     'e.Row.Cells(13).Visible = False 
     'e.Row.Cells(14).Visible = False 
     grdOriginal.Controls(0).Controls.AddAt(0, HeaderRow) 

    End If 
End Sub 

이 난 사용하려고 : How to print header of GridView on each print page,이 작업을 나는 두 개의 열 머리글을하려고 할 때 헤더에 대한 하나 개의 컬럼을 가지고 있지만 작동하지 않는 경우.

몸에는 어떤 생각이 있나요?

덕분에 내가

답변

1

THEAD 아 파크 GRIDVIEW 한 각 인쇄 된 페이지에있는 테이블의 헤더를 유지하는 요소이다.

은 당신이해야 할 일은으로 그리드 뷰를 설정하는 것입니다 : GridView1 당신의 GridView의 ID입니다

GridView1.HeaderRow.TableSection = TableRowSection.TableHeader; 

. 이것은 not yet working on google chrome입니다.

참조 :
Having Google Chrome repeat table headers on printed pages
Repeat table headers in print mode
How do I get Gridview to render THEAD?