[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

how do I make this print button work?

Posted on 2011-02-13
9
Medium Priority
?
456 Views
Last Modified: 2012-05-11
<%@ Control Language="C#" AutoEventWireup="true"  %>



<style type="text/css">
    .style1
    {
        text-align: center;
        font-size: large;
    }
    .style2
    {
        text-align: center;
    }
    .style3
    {
        color: #00CC00;
        font-weight: bold;
    }
    .style4
    {
        color: #33CC33;
        font-size: x-large;
        text-align: center;
    }
    .style5
    {
        background-color: #FFFF99;
    }
    .style6
    {
        color: #FFFFCC;
        background-color: #FF0000;
         font-size: x-large;
   }
</style>
<asp:Button ID="Print" runat="server" Text="Button" />
<p class="style1">
    <span class="style6"> &nbsp;&nbsp;&nbsp;Lot 60 and Lot 61 in Woodland Subdivision</span></p>
<p class="style1">
    <span class="style6"> &nbsp;in White Hall, Arkansas &nbsp;&nbsp;</span></p>

<p class="style1">
    &nbsp;</p>
<p class="style1">
    &nbsp;</p>
<p class="style1">
The 25 feet wide access is part of the lot and it lead to the lot.  This way you will have your own independant driveway.  Please write contact us if you may have any questions. The price of each lot is $28,000.00
    &nbsp;</p>
<p class="style1">

<img alt="" src="../Pictures/Lots/lots6061satview.jpg" />
    &nbsp;</p>

<p class="style1">
These two lots are on Chipmunk road, behind house numbers 141 and 151,
White Hall, Ar-71602
   &nbsp;</p>

<p class="style1">

you may search,
http://maps.google.com


141 chipmunk road, White Hall, Ar-71602

   &nbsp;</p>
0
Comment
Question by:goodk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
  • 2
9 Comments
 
LVL 9

Assisted Solution

by:xav056
xav056 earned 1000 total points
ID: 34884926
try this
<asp:Button ID="Print" runat="server" Text="Button"  OnClientClick="window.print();return false"/>

0
 

Author Comment

by:goodk
ID: 34885056
Oh, yeah thanks - but I wanted it to only print the control file or certain div area. Is it possible? how

myControlFile.ascx
0
 
LVL 9

Assisted Solution

by:xav056
xav056 earned 1000 total points
ID: 34885188
you will have to define this in the css, so in the css file put whatever you want printed  inside a   @media print section, and you will have to have the same css
in @media screen section, if you want the style to display
take a look at
http://www.digital-web.com/articles/css_styling_for_print_and_other_media/
http://www.w3schools.com/CSS/css_mediatypes.asp
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 8

Assisted Solution

by:Anurag Agarwal
Anurag Agarwal earned 1000 total points
ID: 34886593
hello buddy just do the following thing ....

#### Print.css ###########

@media print
{
      Div.a {display :none  }
}

################

<div>
............ Your Control ascx drop it here.............
</div>

<div class="a">
....
....( for content you dont want to print, put all under this div like tables controls etc)
...

<asp:Button ID="btnPrint" runat="server" CssClass="btn" Font-Bold="True" OnClientClick="javascript:window.print()"  Text="Print" />

</div>

---------------------------

This will print only content of first div .............and leave everything under second div
thus you will get print out of your control

0
 

Author Comment

by:goodk
ID: 34892420
but how do I apply it to div if i have many classes?

can you kindly cut and paste my original page and show your solution - thanks
0
 
LVL 8

Assisted Solution

by:Anurag Agarwal
Anurag Agarwal earned 1000 total points
ID: 34894193
goodk in your code which part do u want to print ?? as i m not able to find any control draged in it ??

0
 

Author Comment

by:goodk
ID: 34897801
I am just pulling different control files in the center of the page, I only want to print CPHcontainer.
http://aceyourplace.com/Prod/ForSale.aspx?xControlFile=60_61_ChipmunkLots
thanks for your help


<%@ Page Title="" Language="C#" MasterPageFile="~/Prod/Main.Master" AutoEventWireup="true" CodeBehind="ForSale.aspx.cs" Inherits="AceYP_Oct2010.Prod.ForSale" %>
<script runat="server">


 //   protected override void OnPreInit(EventArgs e)

    protected void Page_Init(object sender, EventArgs e)
    {
        int loop1, loop2;
        string xValue = "4SiennaLakeCove";

        // Load NameValueCollection object.
        NameValueCollection coll = Request.QueryString;
        // Get names of all keys into a string array.
        String[] arr1 = coll.AllKeys;
        for (loop1 = 0; loop1 < arr1.Length; loop1++)
        {
           // Response.Write("Key: " + Server.HtmlEncode(arr1[loop1]) + "<br>");
            String[] arr2 = coll.GetValues(arr1[loop1]);
            for (loop2 = 0; loop2 < arr2.Length; loop2++)
            {
              //  Response.Write("Value " + loop2 + ": " + Server.HtmlEncode(arr2[loop2]) + "<br>");
                xValue = Server.HtmlEncode(arr2[loop2]);
            }
        }
        xValue = "~/Prod/" + xValue + ".ascx";
        Control control = LoadControl(xValue);

        Control placeHolderControl = Page.Controls[0].FindControl("CPHcontainer");
        placeHolderControl = placeHolderControl.FindControl("CPHcenterColumn");
        if (placeHolderControl != null)
        {
           //  placeHolderControl.Controls.Add(new LiteralControl("Added in Code to PH 2."));
            placeHolderControl.Controls.Add(control);
        }



        // placeHolderControl.Controls.Add(new LiteralControl("Added in Code."));
      //  placeHolderControl.Controls.Add(control);
        int cnt = Page.Controls.Count;
    }


   
    </script>
    <asp:Content ID="Content2" ContentPlaceHolderID="CPHrightColumn" runat="server">
        <img alt="" src="../Pictures/houses/Pics/Chipmunk1.jpg" width="140" height="120" />

        <img alt="" src="../Pictures/houses/Pics/DoubleSinks.jpg" width="140" height="120"/>
</asp:Content>
0
 

Accepted Solution

by:
goodk earned 0 total points
ID: 34956530
I am still waiting for a response!!

All I want to do is be able to print a section on the master pages.  so the user can print only a certain section.

thanks
0
 

Author Closing Comment

by:goodk
ID: 35067593
did not quiet answered the question - but I got the idea what to do
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

650 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