Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
How to print multiple pages of listview with default page setting.
i want to set only 8 record in my page after that next 8 records should be print into new page and so on.
i tried so many code and css but unable to set default margine. margine which i am setting is only working for first 2- 3 pages after that records getting merge.
plz help me at this point of time i got frestrated i am tring to acheive this last 3 days but unable to do.below is css and page script which i am using for page.
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <link rel="stylesheet" type="text/css" href="../css/jquery.fancybox-1.3.4.css" media="screen" />
 
    <script type="text/javascript" src="../js/jquery-1.7.1.min.js"></script>
 
    <script type="text/javascript" src="../js/jquery.fancybox-1.3.4.pack.js"></script>
 
    <script type="text/javascript">
        function printpage() {
            window.print()
 
 
        }
    </script>
 
    <style>
        .memberDetailTab td
        {
            text-align: center;
        }
    </style>
    <div class="non-printable">
        <center>
            <h1 class="non-printable">
                Print Address Slips</h1>
        </center>
        <div class="control">
            <table style="margin: 0px auto; border: solid 1px #DCDCD6; width: 70px; page-break-before: always;">
                <tr>
                    <td class="style2">
                         
                    </td>
                    <td>
                         
                    </td>
                </tr>
                <tr>
                    <td align="center">
                        <asp:DropDownList ID="DDLprint" runat="server" OnSelectedIndexChanged="DDLprint_SelectedIndexChanged"
                            AutoPostBack="true">
                            <asp:ListItem Value="0" Selected="True">Select Slip type
                            <asp:ListItem Value="1">Print All Slip
                            <asp:ListItem Value="2">Print Valid Slips
                            <asp:ListItem Value="3">Print Updated Slips
                        
                    </td>
                    <td>
                        <asp:Button ID="Print" Text="Print Slips" runat="server" OnClick="Print_Click" />
                    </td>
                </tr>
                <tr>
                    <td class="style2">
                         
                    </td>
                    <td>
                        
 
                    </td>
                </tr>
            </table>
        </div>
    </div>
    <div id="main-removed" style="overflow: auto; height: 50%; width: 100%" class="printable" />
    <asp:ListView ID="LSVAllSlips" runat="server" GroupItemCount="2" GroupPlaceholderID="groupPlaceholder1"
        ItemPlaceholderID="itemPlaceholder1" OnPagePropertiesChanged="LSVAllSlips_PagePropertiesChanged">
        <layouttemplate>
            <table>
                <tr id="groupPlaceholder1"  runat="server" align="center">
                
            </table>
        </layouttemplate>
        <grouptemplate>
            <tr>
                <td id="itemPlaceholder1"  runat="server">
                
            </tr>
        </grouptemplate>
        <itemtemplate>
            <td>
                <div class="textRotate">
                    <asp:Image ID="imgUrl" runat="server" ImageUrl='<%# Eval("Image")%>' Height="10mm" /></div>
                <%--  <asp:Label ID="lblmemid" runat="server" Text='<%# Eval("MemberShipid") %>' Font-Bold="True"--%>
                <%--Font-Size="Larger" />--%>
            </td>
            <td align="left" style="width: 8.5cm; height: 32.15mm; background: #dedede;">
                <asp:Label ID="lblname" runat="server" Text='<%# Eval("Name") %>' Font-Size="12px"
                    Font-Bold="true" />
 
                <asp:Label ID="lbladd" runat="server" Text='<%# Eval("Address") %>' Font-Size="12px" />
 
                <asp:Label ID="lblcity" runat="server" Text='<%# Eval("City") %>' Font-Size="12px" />,
                <asp:Label ID="lblstate" runat="server" Text='<%# Eval("State") %>' Font-Size="12px" />
                -
                <asp:Label ID="lblpin" runat="server" Text='<%# Eval("Pincode") %>' Font-Size="12px" />
 
                <asp:Label ID="lblcountry" runat="server" Text='<%# Eval("Country") %>' Font-Size="12px" />
 
                Mob:
                <asp:Label ID="lblmo" runat="server" Text='<%# Eval("Mobile1") %>' Font-Size="12px" />&nbsp
                Ph:&nbsp
                <asp:Label ID="lblph" runat="server" Text='<%# Eval("Phone1") %>' Font-Size="12px" />
            </td>
            <td style="width: 5mm;">
            </td>
        </itemtemplate>
        <groupseparatortemplate>
            <tr id="Tr1"  runat="server">
                <td colspan="6" style="height: 2.0mm">
                </td>
            
        </groupseparatortemplate>
    
    
    <%--<div>
       <asp:ListView ID="ListView1" runat="server" OnItemDataBound="OnItemDataBound" GroupPlaceholderID="groupPlaceHolder1"
    ItemPlaceholderID="itemPlaceHolder1">
    <layouttemplate>
        <table cellpadding="2" cellspacing="0" border="1" style="width: 200px; border: dashed 2px #04AFEF;<br mode=" hold=" />            background-color: #B0E2F5">
            <asp:PlaceHolder runat="server" ID="groupPlaceHolder1">
        </table>
    </layouttemplate>
    <grouptemplate>
        <tr>
            <asp:PlaceHolder runat="server" ID="itemPlaceHolder1">
        </tr>
    </grouptemplate>
    <itemtemplate>
        <td>
            <asp:Label ID="lblItem" runat="server" Text='<%# Eval("Item") %>'>
        </td>
        <td>
            <asp:HiddenField ID="hfBarCode" runat="server" Value='<%# Eval("Barcode") %>' />
            <asp:Image ID="imgBarCode" runat="server" />
        </td>
    </itemtemplate>
    </div>--%>
 
<style>
        @media print
        {
            .header, .hide
            {
                visibility: hidden;
                display: none;
            }
            body
            {
                font-size: 10pt;
                padding: 0px;
                margin: 0px 0px 0px 0px;
            }
            .non-printable
            {
                display: none;
            }
            .printable
            {
                display: block;
                display: block;
                margin: 0px 0px 0px 0px;
            }
        }
        @page
        {
            margin: 3.0mm 0mm 0mm 16mm;
        }
        .textRotate
        {
            -webkit-transform: rotate(-90deg);
            -moz-transform: rotate(-90deg);
            -ms-transform: rotate(-90deg);
            -o-transform: rotate(-90deg);
            transform: rotate(-90deg);
            position: relative;
            width: 60px;
        }
        .textRotate img
        {
            margin: 0px;
            padding: 0px;
            position: absolute;
            top: -25px;
            left: -20px;
        }
    </style>
Posted 22-Mar-13 0:48am

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

  Permalink  
Comments
atul_pune at 2-Apr-13 4:56am
   
Hello Vishal i tried this article but not getting solution
VishwaKL at 3-Apr-13 3:54am
   
what is the error / problem you getting

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 350
1 Jochen Arndt 150
2 Richard MacCutchan 135
3 PIEBALDconsult 110
4 Sergey Alexandrovich Kryukov 104
0 OriginalGriff 6,055
1 DamithSL 4,621
2 Maciej Los 4,087
3 Kornfeld Eliyahu Peter 3,500
4 Sergey Alexandrovich Kryukov 3,294


Advertise | Privacy | Mobile
Web04 | 2.8.141220.1 | Last Updated 2 Apr 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100