SQL SERVER REPORT ALIGNMENT TO CENTER OF WEB PAGE

Pravesh Singh

Total Post:412

Points:2888
Posted by  Pravesh Singh
 4211  View(s)
Ratings:
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!
  1. AVADHESH PATEL

    Post:604

    Points:4228
    Re: Sql server report alignment to center of web page

    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);
                }

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!