Solved

Printing Selected Records from a ListView Asp.NET 3.5

Posted on 2010-08-25
13
314 Views
Last Modified: 2012-06-27
Does anyone know who can implement a print functionality which would allow me to select the records I want to print and display a Print Preview page, please se this example. My page is built on ASP.NET 3.5 and VB code behind thanks

http://cphp.com/find-a-provider/

go to find a provider and choose any of them..


thanks
0
Comment
Question by:TonyReba
  • 8
  • 5
13 Comments
 
LVL 9

Accepted Solution

by:
puru1981 earned 500 total points
ID: 33521767
you can use selecteditems of listview to control waht need to be printed and here is the example how to display preview of a document.

http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/Q_26427571.html
0
 
LVL 9

Author Comment

by:TonyReba
ID: 33521901
how do I use selecteditems from the listview1
<asp:ListView ID="ListView1" runat="server" DataSourceID="AccessDataSource2"  >



         <EmptyDataTemplate>

         <span></span>

        </EmptyDataTemplate>

    <GroupTemplate>

            <tr ID="itemPlaceholderContainer" runat="server">

                <td ID="itemPlaceholder" runat="server">

                </td>

            </tr>

        </GroupTemplate>

        <ItemTemplate>

        <br />

        <table runat = "server" class ="middle_box_content" ></table>

            <span style="background-color: #E0FFFF;color: #333333;">

      <b>

            <asp:Label ID="Last_NameLabel" runat="server" Text='<%# Eval("Last Name") %>' />

            ,

             <asp:Label ID="First_NameLabel" runat="server" 

             Text='<%# Eval("First Name") %>' />

             <br />

               <asp:Label ID="Prof_DesigantionLabel" runat="server" 

             Text='<%# Eval("Prof Designation") %>' /></b>

             </b>

             <br />

            <asp:Label ID="SpecialtyLabel" runat="server" Text='<%# Eval("Specialty") %>' />

            <asp:Label ID="Specialty_2Label" runat="server" 

            Text='<%# Eval("[Specialty2]") %>' />

            <br />

            <asp:Label ID="AddressLabel" runat="server" Text='<%# Eval("Address") %>' />

            <br />

            <asp:Label ID="Address2Label" runat="server" Text='<%# Eval("Address2") %>' />

            <br />

            <asp:Label ID="CityLabel" runat="server" Text='<%# Eval("City") %>' />

            ,

            <asp:Label ID="StateLabel" runat="server" Text='<%# Eval("State") %>' />

            ,

            <asp:Label ID="ZipLabel" runat="server" Text='<%# Eval("Zip") %>' />

            <br />

            <asp:Label ID="PhoneLabel" runat="server" Text='<%# Eval("Phone") %>' />

            <br />

            <asp:Label ID="FaxLabel" runat="server" Text='<%# Eval("Fax") %>' />

            <br />

<br />

</span>

</table>

        </ItemTemplate>





        <AlternatingItemTemplate>

        

            <span style="background-color: #FFFFFF;color: #284775;">

                  <b>

            <asp:Label ID="Last_NameLabel" runat="server" Text='<%# Eval("Last Name") %>' />

            ,

             <asp:Label ID="First_NameLabel" runat="server" 

             Text='<%# Eval("First Name") %>' />

             <br />

               <asp:Label ID="Prof_DesigantionLabel" runat="server" 

             Text='<%# Eval("Prof Designation") %>' /></b>

             </b>

             <br />

            <asp:Label ID="SpecialtyLabel" runat="server" Text='<%# Eval("Specialty") %>' />

            <br />

            <asp:Label ID="Specialty_2Label" runat="server" 

            Text='<%# Eval("[Specialty2]") %>' />

            <br />

            <asp:Label ID="AddressLabel" runat="server" Text='<%# Eval("Address") %>' />

            <br />

            <asp:Label ID="Address2Label" runat="server" Text='<%# Eval("Address2") %>' />

            <br />

            <asp:Label ID="CityLabel" runat="server" Text='<%# Eval("City") %>' />

            ,

            <asp:Label ID="StateLabel" runat="server" Text='<%# Eval("State") %>' />

            ,

            <asp:Label ID="ZipLabel" runat="server" Text='<%# Eval("Zip") %>' />

            <br />

            <asp:Label ID="PhoneLabel" runat="server" Text='<%# Eval("Phone") %>' />

            <br />

            <asp:Label ID="FaxLabel" runat="server" Text='<%# Eval("Fax") %>' />

            <br />

<br />

</span>

</span>

        </AlternatingItemTemplate>

   <LayoutTemplate>

            <table id="Table1" runat="server">

                <tr id="Tr1" runat="server">

                    <td id="Td1" runat="server">

                        <table ID="groupPlaceholderContainer" runat="server" border="1" 

                            style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;font-family: Verdana, Arial, Helvetica, sans-serif;">

                            <tr ID="groupPlaceholder" runat="server">

                            </tr>

                        </table>

                    </td>

                </tr>

                <tr id="Tr2" runat="server">

                    <td id="Td2" runat="server" 

                        style="text-align: center;background-color: #5D7B9D;font-family: Verdana, Arial, Helvetica, sans-serif;color: #FFFFFF">

                        <asp:DataPager ID="DataPager1" runat="server" PageSize="12">

                            <Fields>

                                <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" 

                                    ShowLastPageButton="True" />

                            </Fields>

                        </asp:DataPager>

                    </td>

                </tr>

            </table>

        </LayoutTemplate>

        

    </asp:ListView>

Open in new window

0
 
LVL 9

Author Comment

by:TonyReba
ID: 33521915
did you go over the sample site?
0
 
LVL 9

Expert Comment

by:puru1981
ID: 33522466
yes i have been to the website. you have added checkboxes. you can use these checkboxes to identify the records need to be selected in the print preview.
0
 
LVL 9

Author Comment

by:TonyReba
ID: 33522623
thats the mockup site... I am right now till the point I select the checkboxes, but dont know how to show this in a page and have the print method come out...

any suggestions?
0
 
LVL 9

Author Comment

by:TonyReba
ID: 33525020
hi anyone there?
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 9

Author Comment

by:TonyReba
ID: 33531914
Is not a word document, but an html aspx page
0
 
LVL 9

Expert Comment

by:puru1981
ID: 33534191
you can use word API to do the print preview.

secondly, you can remove the print button from the item template and use it in the form so that it will check for the selected items and then print it.
0
 
LVL 9

Author Comment

by:TonyReba
ID: 33534534
Oh wow that sounds cool, how do I download the word api?
0
 
LVL 9

Expert Comment

by:puru1981
ID: 33534741
word api is a com component. when you go to add reference click on COM tab you will get api in the listing.
0
 
LVL 9

Author Comment

by:TonyReba
ID: 33534886
oh my bad
let me try that
0
 
LVL 9

Author Comment

by:TonyReba
ID: 33535071
I added to my project now how I go about it? is there any article?
0
 
LVL 9

Expert Comment

by:puru1981
ID: 33535909
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Any business that wants to seriously grow needs to keep the needs and desires of an international audience of their websites in mind. Making a website friendly to international users isn’t prohibitively expensive and can provide an incredible return…
Developer portfolios can be a bit of an enigma—how do you present yourself to employers without burying them in lines of code?  A modern portfolio is more than just work samples, it’s also a statement of how you work.
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
This video teaches users how to migrate an existing Wordpress website to a new domain.

947 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now