locked
how to display field info in reportviewer header? RRS feed

  • Question

  • User-1625098594 posted

    I have a local report that's being displayed in reportviewer control.

    I have to display few fields in reportviewer header and would like to display them in all pages of report.

    can anyone help me how to achieve this?

    Thanks in advance,

    Rajanikanth. 

     

    Thursday, August 2, 2007 12:59 AM

Answers

  • User-1625098594 posted

    Hi Joshi,

    Thanks for the link. before posting here, i tried the steps given mentioned in your link. Unfortunately, it didn`t work as expected.

    I found a neater way of adding headers to local report with using ReportParameters.

    1. Create required ReportParameters using a dailog with menu item Report->ReportParameters. Report menu is displayed when focus is set to ur report rdlc file.

    2. use the following logic in ur souce file

    ReportParameter[] repParamHeader = new ReportParameter[10];

    string str = drHeader[0].ToString();repParamHeader[0] = new ReportParameter("RP_Var1", str, false);

    str = drHeader[1].ToString();

    repParamHeader[1] = new ReportParameter("RP_Var2", str, false);

    ReportViewer_Cert.LocalReport.SetParameters(repParamHeader);

    3. create a text box in local report header and add following expression to display required field value :

    =Parameters!RP_Var1.Value

    That's it!

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, August 7, 2007 8:41 AM

All replies

  • User-46028669 posted

    You will need to add page headers to the reportviewer control.

    See this link for more http://msdn.microsoft.com/en-us/library/ms252093(VS.80).aspx

    Cheers

    Vishal Khanna

    (pls mark as answer if reply helps)

    Thursday, August 2, 2007 3:14 AM
  • User-1625098594 posted

    thanks for reply. 

    I gone through this link already.

    problem is,  If reportviewer has more than one page to be displayed, the field value is displayed only on first page. I would like to have field value to be displayed in Page header in all pages. any idea how to do this?

    Thursday, August 2, 2007 5:07 AM
  • User1805008792 posted

    Hi Rajanikanth,

    Instead of adding the fields(textbox etc)  in header add them to the body and right-click the textbox control, etc in Layout view -> select Properties -> select the General tab -> select 'Repeat report Item with data region on every page' and select the table control/data region that will continue on multiple pages.

    Apart from this check this link for other solution -

    http://blogs.msdn.com/chrishays/archive/2006/09/27/ContinuedHeader.aspx

    Friday, August 3, 2007 6:36 AM
  • User-1625098594 posted

    Hi Joshi,

    Thanks for the link. before posting here, i tried the steps given mentioned in your link. Unfortunately, it didn`t work as expected.

    I found a neater way of adding headers to local report with using ReportParameters.

    1. Create required ReportParameters using a dailog with menu item Report->ReportParameters. Report menu is displayed when focus is set to ur report rdlc file.

    2. use the following logic in ur souce file

    ReportParameter[] repParamHeader = new ReportParameter[10];

    string str = drHeader[0].ToString();repParamHeader[0] = new ReportParameter("RP_Var1", str, false);

    str = drHeader[1].ToString();

    repParamHeader[1] = new ReportParameter("RP_Var2", str, false);

    ReportViewer_Cert.LocalReport.SetParameters(repParamHeader);

    3. create a text box in local report header and add following expression to display required field value :

    =Parameters!RP_Var1.Value

    That's it!

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, August 7, 2007 8:41 AM
  • User166505692 posted

    Thank You... You saved me...

    Friday, March 2, 2012 10:58 AM