How i can give dynamic margin to the rdlc report in ASP.NET C#?
I have tried this code but it is not working.......
System.Drawing.Printing.PageSettings settings = new System.Drawing.Printing.PageSettings(); //hundredth of inch settings.Margins.Top = topMargin; settings.Margins.Left = leftMargin; settings.Margins.Bottom = bottomMargin; settings.Margins.Right = rightMargin; MainReportViewer.SetPageSettings(settings);
You can give try to this code
// creates a new page setting PageSettings instance = new PageSettings(); // create the new margin values (left,right,top,bottom) Margins value = new Margins(0, 0, 0, 0); // gives your new pagesetting a value instance.Margins = value; // report viewer now sets your margins ReportViewer1.SetPageSettings(instance);
Here is similar question with answer
which says as per what I understand you cannot set using C#, but can set margin using JS code
Subscribe to our weekly Newsletter & Keep getting latest article/questions in your inbox weekly