Solved

How to center and print multiple panels

Posted on 2012-03-10
20
360 Views
Last Modified: 2012-03-15
Hello,

How do you center a panel, I tried the following code but it doesn't work.

<asp:Panel ID="Panel6" runat="server" BorderStyle="Solid" Width="1100px" position="Center">

Also How do you print a specific panel or all the panels in a web form? I am using ASP.NET with VB.NET code.

Thanks,

Victor
0
Comment
Question by:vcharles
  • 12
  • 8
20 Comments
 

Author Comment

by:vcharles
Comment Utility
Also, I forgot to mention. How do you navigate through multiple panels (MoveNext, MovePrevious, MoveFirst, MoveLast)?
0
 
LVL 83

Expert Comment

by:CodeCruiser
Comment Utility
What is your overall layout mechanism? Tables?

Not sure about navigation. Panels are individual controls so there is no next previous. How are you displaying these panels?

For printing, draw the specific HTML on page and then File->Print will do the magic.
0
 

Author Comment

by:vcharles
Comment Utility
My panels are inside a table, I tried centering the table but is still doesn't work. In some cases I have a table with two columns, each containing a separate panel, I think if will be best to center the table with the panels inside of it, is that possible? In regards to printing not certain what you mean, is there a way to print the data from the panel/table?

Thanks,

Victor
0
 
LVL 83

Expert Comment

by:CodeCruiser
Comment Utility
For centering, you have two things. Centering the tables first and then centering the contents of the tables within cells.

> In regards to printing not certain what you mean, is there a way to print the data from the panel/table?

The easiest way of printing on webpages is to render a page and then allow users to print the page. So what I meant was that if you need to print a portion of page then render that portion as a separate page and users can print it.
0
 

Author Comment

by:vcharles
Comment Utility
Hi,

Can you pleae send me an example on how to center a table with two panels within the table?
How do i render a pager to allow users to print the data in my two panels?

Thanks,

Victor
0
 

Author Comment

by:vcharles
Comment Utility
Hi, what is the proper syntax to center a table on my form position = "center" does not work, as mentioned I need to center a table and panels within the table.

Code:

 <asp:View ID="View1" runat="server">
            <div>
     
       <table cellpadding="0" cellspacing="0" position = "center">
           <tr>
               <td class="style1171">
                      <asp:Panel ID="Panel5" runat="server" Width="450px" BorderStyle="Solid"

Victor
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 500 total points
Comment Utility
Examples here

http://theodorakis.net/tablecentertest.html

Does the view cover the wider area than covered by table?
0
 

Author Comment

by:vcharles
Comment Utility
Thanks. the table is within the panel, just need to center the panels within the main table and the tablers within the panels. I tried the code below but the table within the panel doesn't center, any ideas what is wrong  with the syntax?

<asp:View ID="View2" runat="server">
              <table cellpadding="0" cellspacing="0" class="center1"> ****Works
            <tr>
            <td>
              <asp:Panel ID="Panel6" runat="server" BorderStyle="Solid" Width="1080px">
            <table cellpadding="0" cellspacing="0" class="center1">  ++++Does not work
            <tr>




Style used:
.center1
{
margin-left: auto;
margin-right: auto;
}


Victor
0
 
LVL 83

Expert Comment

by:CodeCruiser
Comment Utility
Can you put

Border="1"

on both tables and show me a screenshot?
0
 

Author Comment

by:vcharles
Comment Utility
It's working, how do you set the width of your <td> and also center the data within the <td> tag?

Thanks,

Victor
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

 

Author Comment

by:vcharles
Comment Utility
Hi,

I can't seem to control the size of my TD tag, for example with the code below, eventhough the width is set to 150px to ofit the size of the button, it is still much wider than the button, but it shows 150px, can't figure out why both width are 150px but the width TD tag is wider than the button.

<td width="150px">
                     <asp:Button ID="Button140" runat="server" ForeColor="Red" Text="Exit Program"
                         Width="150px" />
                 </td>
0
 

Author Comment

by:vcharles
Comment Utility
Please disregard my last message, I just have to play around with it, lots of little details I need to understand about tables. Thanks for all your Help with centering on setting the width and centering the controls.

Can you please help me more on how to print the contents in a table. I don't understand how to draw the specific HTML on page and then File->Print

Thanks.
0
 
LVL 83

Expert Comment

by:CodeCruiser
Comment Utility
Try using CSS for width rather than width property.

For printing, if you just want to print the table and not the rest of the page then you need to copy that table HTML into another page which only contains that table and nothing else. Then it can be printed.
0
 

Author Comment

by:vcharles
Comment Utility
Do you mean I can then use the browser's print feature to print the page? I would like to have more control over which tables I want to print, is there a way to do this using code with a Print button created from the application?

Basically. I have 8 screen currently in a multiview control, I was told needed to use panels to print multiple screens, now I have the panels within a main table within a multiview control, In order to print I guess I would need to remove the multiview control and just use the main table with the panels within the table, that should work right?

Also, when putting all 8 tables in a separate .aspx file how I make sure each table is printed in a separate page?

Thanks,

Victor
0
 
LVL 83

Expert Comment

by:CodeCruiser
Comment Utility
>Also, when putting all 8 tables in a separate .aspx file how I make sure each table is printed in a separate page?

You need to show them one by one and then print.

>Basically. I have 8 screen currently in a multiview control, I was told needed to use panels to print multiple screens

So the idea would be to show one view then print then show another view then print and so on.

>I would like to have more control over which tables I want to print, is there a way to do this using code with a Print button created from the application?

You can put a button which would call the "window.print()" but you can not directly control it.
0
 

Author Comment

by:vcharles
Comment Utility
You need to show them one by one and then print.

How do I show them one by one? for example if I only one to print screens 1 and three, how do I only show screens 1 and three if I'm using the browser's print button? If possible can you please send me an exmaple.

So the idea would be to show one view then print then show another view then print and so on.

Can't I print all the views at once?

You can put a button which would call the "window.print()" but you can not directly control it.


Can I contriol the table I want to print from the  "window.print()"  button?


Thanks.
0
 
LVL 83

Expert Comment

by:CodeCruiser
Comment Utility
>How do I show them one by one? for example if I only one to print screens 1 and three, how do I only show screens 1 and three if I'm using the browser's print button?

You have to focus on DISPLAYing not printing. Whatever is displayed in browser will be printed by the browser. If you want to print view 1 and 3 then

either user displays the view1 (using a button for example which sets the current view of the multiview control) and prints it then displays view3 and prints it

or your code has to do it somehow (probably showing each view separately in its own window. But that would not be a view. It would be a page. What I mean is that whatever is being shown in view (a gridview for example) would need to be displayed on a separate page and printed. One way of doing this could be multiple copies of this same page are opened and a view number passed in querystring and page sets the current view based on that. You can also pass a print verb in querystring which page checks on load and issues the window.print command.
0
 

Author Comment

by:vcharles
Comment Utility
Hello,

Do you have any links that shows examples on how to do this? or can you send me an example.

Also, I ran into an issue with seeing the lines that separates the rows and columns, currently I have to add  bgcolor="#CCCCCC" in each <TD> tag in order to see the lines, is their a way better way to do this? if yes, can you please send me an example.

Thanks,

Victor
0
 
LVL 83

Expert Comment

by:CodeCruiser
Comment Utility
I am sorry Victor I won't be able to show any examples. I am not very good at layouts and styling myself. I gave you an idea of how this can be achieved.
0
 

Author Comment

by:vcharles
Comment Utility
Ok. Thanks.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

763 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

11 Experts available now in Live!

Get 1:1 Help Now