Solved

Printing Selected Records from a ListView Asp.NET 3.5

Posted on 2010-08-25
13
311 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
Comment Utility
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
Comment Utility
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
Comment Utility
did you go over the sample site?
0
 
LVL 9

Expert Comment

by:puru1981
Comment Utility
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
Comment Utility
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
Comment Utility
hi anyone there?
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 9

Author Comment

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

Expert Comment

by:puru1981
Comment Utility
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
Comment Utility
Oh wow that sounds cool, how do I download the word api?
0
 
LVL 9

Expert Comment

by:puru1981
Comment Utility
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
Comment Utility
oh my bad
let me try that
0
 
LVL 9

Author Comment

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

Expert Comment

by:puru1981
Comment Utility
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
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…

743 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

8 Experts available now in Live!

Get 1:1 Help Now