Last post Feb 12, 2019 06:44 AM by Jenifer Jiang
Jan 31, 2019 09:10 AM|qsoft_developer|LINK
I really need your help with printing a gridview that is inside an iframe.
The gridview has AllowPaging set to true, and I would like for each page to be printed in a new page with the report header.
<span class="report_right_toolbar showmenu" id="printSpan" >
<asp:ImageButton ID="print" runat="server" Width="25px" CssClass="toolbarImage"
ImageUrl="~/Images/Devices-printer-icon.png" OnClientClick = "return PrintPanel();" ToolTip="Print"/>
<iframe id="QurRep" scrolling="auto" style="width:99%; height:97%;" runat="server" ></iframe>
The iframe src is TabularReport.aspx and I add it from code behind, with some parameters.
<body id="pageBody" runat="server">
<form id="tabular_report" runat="server">
<asp:GridView ID="GridView1" runat="server"
OnSorting="GridView_Sorting" HeaderStyle-HorizontalAlign="Center" OnPageIndexChanging="PageIndexChanging"
OnRowCreated="GridView1_RowCreated" OnRowDataBound="GridView1_RowDataBound" >
<asp:CheckBox ID="CheckBox_Items" runat="server" />
<asp:HiddenField ID="HiddenField_TotalRec" runat="server" />
I bind the grid using the following function (from DB):
run_Grid("GridView1", "", "");
Jan 31, 2019 10:02 AM|yogyogi|LINK
You can do this by passing the page number to the url of the page that has gridview. So this makes sense because you can then get the page number from
Request.QueryString and then you can bind the gridview based on the page number.
In your ifame you give the src with the page of the gridview with the page number in querystring. See below:
<iframe id="QurRep" src="TabularReport.aspx?pn=2" scrolling="auto" style="width:99%; height:97%;" runat="server" ></iframe>
Notice the src property set as src="TabularReport.aspx?pn=2". I think this way you can do your work.
Basically you are trying to acheive this:
There is another way to achive this by binding the other page's gridview using ajax and reuse it in multiple pages. I provide you a reference of this tutorial - Bind GridView with Paging using
jQuery Load with No Page Refresh
I hope it helps you.
Thanks & Regards
Feb 04, 2019 07:43 AM|qsoft_developer|LINK
I need to print all pages in one click, that is actually my problem.
The number of rows in a page needs to be as defined in the table pager.
The table is inside the iframe, but the print icon is located in the page that contains the iframe.
If the iframe only makes things complicated, I can first try and find a solution for printing all pages with one click, within the iframe.
I need to see the header and page number in each page.
I found the following solution but I'm not sure how to use it with my code:
Feb 12, 2019 06:44 AM|Jenifer Jiang|LINK
According to your description, I'm confused about your requirement.
An iframe is just a medium that shows the links you need.
What you want to do in your page is decided by the thing you've done in the link.
In my opinion, as long as you follow the link and could print the page, it will also work in the iframe.
The function you've achieved in the TabularReport will not be affected by the iframe page.