locked
Report Viewer - RDLC RRS feed

  • Question

  • User-286235245 posted

    Dear Friends,

           My need is to generate Report using RDLC(Report Wizard) for Markslist of the student by giving the name of student. This scenario is working perfectly.

    But my need is to add the TEXTBOX in Report Header that should generate the "Institution Name". I am new to this concept.

    .CS Code is:

    public void ShowReport()
    {
    ReportViewer1.Reset();
    ReportDataSource rds = new ReportDataSource();
    rds.DataSourceId = "ObjectDataSource1";
    rds.Name = "DataSet1";


    ReportViewer1.LocalReport.DataSources.Clear();
    ReportViewer1.LocalReport.ReportPath = "C:\\inetpub\\wwwroot\\LocalReport01\\RegistrationReport.rdlc";
    ReportViewer1.LocalReport.DataSources.Add(rds);

    ObjectDataSource1.SelectParameters.Clear();
    ObjectDataSource1.SelectParameters.Add("RPTGENDER", TextBox1 .Text);

    ReportParameter[] param = new ReportParameter[1];
    param[0] = new ReportParameter("RPTGENDER", TextBox1.Text);
    ReportViewer1.LocalReport.SetParameters(param);

    ReportViewer1.LocalReport.Refresh();
    }

     I dono how to achieve this. Can anyone please guide me to resolve this issue. Its a very Urgent one.

    Tuesday, September 18, 2012 5:34 AM

Answers

  • User-8475372 posted

    Dear User, 

    If you want to do this from the report viewer itself, its a very simple process. All you need to do is, right click in the empty area around the report, you would be able to see the Report Header option, select it, an area at the top will be spaced out. Right click and insert a text box with the value you desire in it. 

    In case, you need to have a dynamic value, right click on it and select the value, choose the value from the dataset you wish to have it there.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, September 21, 2012 5:13 AM

All replies

  • User423701163 posted

    Hello,

    So basically you need to pass a parameter to your report that gets it's value from TextBox1.Text, am I right? I just answered a similar question on the following thread (the code is in VB.Net but can easily be converted to C# using an on-line convertor tool):

    http://forums.asp.net/t/1844729.aspx/1?RE+Pass+Parameter+Values+to+Reportviewer+in+VB+NET

    Regards and good luck,

    M.R.

    Thursday, September 20, 2012 2:34 PM
  • User-8475372 posted

    Dear User, 

    If you want to do this from the report viewer itself, its a very simple process. All you need to do is, right click in the empty area around the report, you would be able to see the Report Header option, select it, an area at the top will be spaced out. Right click and insert a text box with the value you desire in it. 

    In case, you need to have a dynamic value, right click on it and select the value, choose the value from the dataset you wish to have it there.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, September 21, 2012 5:13 AM