Solved

How to center and print multiple panels

Posted on 2012-03-10
20
370 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
[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
  • 12
  • 8
20 Comments
 

Author Comment

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

Expert Comment

by:CodeCruiser
ID: 37705935
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
ID: 37706003
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
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 
LVL 83

Expert Comment

by:CodeCruiser
ID: 37706971
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
ID: 37707096
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
ID: 37709414
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
ID: 37717474
Examples here

http://theodorakis.net/tablecentertest.html

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

Author Comment

by:vcharles
ID: 37717858
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
ID: 37717899
Can you put

Border="1"

on both tables and show me a screenshot?
0
 

Author Comment

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

Thanks,

Victor
0
 

Author Comment

by:vcharles
ID: 37718735
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
ID: 37718862
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
ID: 37719564
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
ID: 37719750
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
ID: 37719843
>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
ID: 37719940
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
ID: 37720004
>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
ID: 37723875
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
ID: 37724270
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
ID: 37724290
Ok. Thanks.
0

Featured Post

Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

730 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