Home > DeveloperSection > Forums > Sql server report alignment to center of web page
Pravesh Singh

Total Post:412

Posted on    April-06-2013 1:39 AM

 MS Access MS Access 

 1 Reply(s)
 4030  View(s)
Rate this:
Hi All!

I am using SQL Server Reporting service for reports and displaying it with Report viewer control. It is displaying the report on left side of the page. I want it to be center aligned.

I tried Following things but it didn't worked out.

Wrapping Report viewer control in div or table and make it center aligned.
Zoom mode of Report viewer Control.
So please give me some solution for making it center aligned.

Thanks in advance!


Total Post:604

Posted on    April-06-2013 8:21 AM

Hi Pravesh!

You can do as below

<div align="center">

    <rsweb:ReportViewer ID="ReportViewer1" runat="server" DocumentMapWidth="100%"
    Font-Names="Verdana" Font-Size="8pt" PromptAreaCollapsed="True"
    ShowToolBar="False" Width="1100px" Height="100%">

it work with jquery also on client side

$('#ReportViewer1_fixedTable tbody tr').attr("align", "center");

with server side

ReportPageSettings rst = rptVwr.LocalReport.GetDefaultPageSettings();
            if (rptVwr.ParentForm.Width > rst.PaperSize.Width)
                int vPad = (rptVwr.ParentForm.Width - rst.PaperSize.Width) / 2;
                rptVwr.Padding = new Padding(vPad, 1, vPad, 1);

Don't want to miss updates? Please click the below button!

Follow MindStick