Language: ASP.net / VB.net
Platform: Visual Studio 2010 with ASP.net
Technology: Used in ASP.net
-------------
Right now, I'm working with my report of of how to export Gridview Table with repeat table header on the next page.
can someone teach me how to do that.
here's my ASP.NET code: -
<asp:GridView ID="gv" runat="server" BackColor="White" BorderColor="#336666"
-
BorderStyle="Double" BorderWidth="3px" CellPadding="4"
-
Font-Names = "Arial" style="text-align: center"
-
EmptyDataText="No Records Found." GridLines="Horizontal">
-
<FooterStyle BackColor="White" ForeColor="#333333" />
-
<HeaderStyle BackColor="#336666" Font-Bold="True" ForeColor="White"
-
BorderStyle="Solid" />
-
<PagerStyle BackColor="#336666" ForeColor="White" HorizontalAlign="Center" />
-
<RowStyle BackColor="White" ForeColor="#333333" />
-
<SelectedRowStyle BackColor="#339966" Font-Bold="True" ForeColor="White" />
-
<SortedAscendingCellStyle BackColor="#F7F7F7" />
-
<SortedAscendingHeaderStyle BackColor="#487575" />
-
<SortedDescendingCellStyle BackColor="#E5E5E5" />
-
<SortedDescendingHeaderStyle BackColor="#275353" />
-
</asp:GridView>
-
VB.NET codes: -
Private Sub LoadMachineSearch()
-
Using con As New SqlConnection(ConStrX)
-
Using cmd As New SqlCommand("SELECT OVERALL_SUPPLIES.QRCode as [QR CODE], OVERALL_SUPPLIES.ItemCode as [ITEM CODE], OVERALL_SUPPLIES.ItemName as [ITEM NAME], OVERALL_SUPPLIES.Specification as [SPECIFICATION], OVERALL_SUPPLIES.MinQty as [MIN QTY], OVERALL_SUPPLIES.UnitOfMeasure as [UM], OVERALL_SUPPLIES.Currency as [CCY], OVERALL_SUPPLIES.UnitPrice as [UPRICE], OVERALL_SUPPLIES.BIqty as [BEG QTY], OVERALL_SUPPLIES.BIamount as [BEG AMT], OVERALL_SUPPLIES.Rqty as [RCV QTY], OVERALL_SUPPLIES.Ramount as [RCV AMT], IssuanceRecords.IssuedQty as [ISSUED QTY], IssuanceRecords.IssuedAmount as [ISSUED AMT], OVERALL_SUPPLIES.AAqty as [ADJ/ALLOC QTY], OVERALL_SUPPLIES.AAamount as [ADJ/ALLOC AMT], OVERALL_SUPPLIES.EIqty as [ENDING QTY], OVERALL_SUPPLIES.EIamount as [ENDING AMT], OVERALL_SUPPLIES.AIqty as [ACTL QTY], OVERALL_SUPPLIES.AIamount as [ACTL AMT], OVERALL_SUPPLIES.Dqty as [DIFF QTY], OVERALL_SUPPLIES.Damount as [DIFF AMT] FROM IssuanceRecords INNER JOIN OVERALL_SUPPLIES ON OVERALL_SUPPLIES.QRCode = IssuanceRecords.QRCode AND OVERALL_SUPPLIES.MonthYear = IssuanceRecords.MonthYear AND OVERALL_SUPPLIES.ItemCode = IssuanceRecords.ItemCode WHERE OVERALL_SUPPLIES.MonthYear = '32016'")
-
Using sda As New SqlDataAdapter()
-
cmd.Connection = con
-
sda.SelectCommand = cmd
-
Using dt As New DataTable()
-
sda.Fill(dt)
-
gv.DataSource = dt
-
gv.DataSourceID = Nothing
-
gv.DataBind()
-
End Using
-
End Using
-
End Using
-
End Using
-
End Sub
-
-
Protected Sub btnPDF_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnPDF.Click
-
Response.ContentType = "application/pdf"
-
Response.AddHeader("content-disposition",
-
"attachment;filename=GridViewExport.pdf")
-
Response.Cache.SetCacheability(HttpCacheability.NoCache)
-
Dim sw As New StringWriter()
-
Dim hw As New HtmlTextWriter(sw)
-
gv.AllowPaging = False
-
LoadMachineSearch()
-
gv.RenderControl(hw)
-
-
Dim sr As New StringReader(sw.ToString())
-
Dim pdfDoc As New Document(New RectangleReadOnly(1587, 1122), 10.0F, 10.0F, 10.0F, 0.0F)
-
Dim htmlparser As New HTMLWorker(pdfDoc)
-
PdfWriter.GetInstance(pdfDoc, Response.OutputStream)
-
pdfDoc.Open()
-
htmlparser.Parse(sr)
-
pdfDoc.Close()
-
Response.Write(pdfDoc)
-
Response.End()
-
End Sub
-
1 2073
I would suggest to create just a report (SSRS) and export it as a pdf.
There is no need to keep this as a part of ASP.Net GridView
Please let me know if this isn't suffice the actual requirement
Sign in to post your reply or Sign up for a free account.
Similar topics
by: JJ |
last post by:
Hi,
usually, I'm not using MS servers, but I have a big problem with a
Access table.
I should create a web application for a Historical Dipartment.
They have create a populated a Access...
|
by: weiwei |
last post by:
Hi,
I have a table in View and I want to export that table into the excel
sheet.
I know that I can export file in Tables where there is a all task
function, however, I cannt' find that function...
|
by: JJ |
last post by:
Hi,
usually, I'm not using MS servers, but I have a big problem with a
Access table.
I should create a web application for a Historical Dipartment.
They have created a populated a Access...
|
by: bwhite |
last post by:
I have a temp table with one row of data that I need to export into
Excel. I created the export to create the xls file as follows ...
Dim FileName
FileName = !!
DoCmd.SetWarnings False...
|
by: keithb |
last post by:
Is there a way to make a GridView header row invisible?
Thanks,
Keith
|
by: dfdavis.mtu |
last post by:
I have a table that I dynamically fill with data from a database for
medical companies to be able to determine if their patients meet
certain criteria. However they want a fixed header for it so...
|
by: Burbletrack |
last post by:
Hi All,
Hope someone can help me...
Im trying to highlight the advantages of using table variables as
apposed to temp tables within single scope.
My manager seems to believe that table...
|
by: =?Utf-8?B?bWFuaWthMDI=?= |
last post by:
Hi,
I have a GridView control in page called eventslisting which is inheriting
from a MasterPage. The normal code to export to GridView does not work and
gives me an error - "Control of type...
|
by: Sashi |
last post by:
Hi All,
I have a table from which I want to export the data as a plain text
file.
I exported the data using the "Export" option and selected the comma
as a separator and the " as the Text...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
| |