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

Total Post:411

Points:2881
Posted on    April-06-2013 1:39 AM

 MS Access MS Access 
Ratings:


 1 Reply(s)
 2985  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!


AVADHESH PATEL

Total Post:604

Points:4228
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%">
    </rsweb:ReportViewer>
</div>

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