Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6253021
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T13:54:50+00:00 2026-05-24T13:54:50+00:00

I’m building a small application in Visual Studio 2010 with .Net 4.0 and C#

  • 0

I’m building a small application in Visual Studio 2010 with .Net 4.0 and C# where I’m generating a ReportViewer-report from a List. I then have a subreport in my tablix that should pass a property-value from WebLink called ProviderIdentifier. I implement the SubReportProcessing-event on my report to return data to the subreport like this:

private void localReport_SubreportProcessing(object sender, SubreportProcessingEventArgs e)
{
    List<WebLink> links = LinkProvider.FetchSublinks(LinkProvider.Fetch(new WebLink(new Uri("http://www.contentstudio.se/"))));
    e.DataSources.Add(new ReportDataSource("ParentLinks", links));
}

Currently I return the same links for all instances of the subreport. The report works fine until I try to pass a parameter to the subreport. When I add the parameter using ProviderIdentifier (which I can display in my report without problem) I always get a NullReferenceException with the message “Object reference not set to an instance of an object.” when I call Render() on my LocalReport-object. The same happens if I add a static value (like 1) to the report instead of passing ProviderIdentifier. If I remove the parameter all together it works great though but I have no way to identify which links to return to the subreport.

Anyone know what could cause this problem?

Complete code:

public void RenderReport()
{
    LocalReport localReport = new LocalReport
                                    {
                                        ReportPath = ("BrokenLink.rdlc"),
                                        EnableHyperlinks = true,
                                        ShowDetailedSubreportMessages = true
                                    };

    List<WebLink> links = LinkProvider.FetchSublinks(LinkProvider.Fetch(new WebLink(new Uri("http://www.contentstudio.se/"))));

    ReportDataSource reportDataSource = new ReportDataSource("Weblinks", links);
    localReport.DataSources.Add(reportDataSource);

    localReport.SubreportProcessing += localReport_SubreportProcessing;

    const string reportType = "PDF";
    string mimeType;
    string encoding;
    string fileNameExtension;

    //The DeviceInfo settings should be changed based on the reportType
    //http://msdn2.microsoft.com/en-us/library/ms155397.aspx
    const string deviceInfo = "<DeviceInfo>" +
                                "  <OutputFormat>PDF</OutputFormat>" +
                                "  <PageWidth>8.5in</PageWidth>" +
                                "  <PageHeight>11in</PageHeight>" +
                                "  <MarginTop>0.5in</MarginTop>" +
                                "  <MarginLeft>1in</MarginLeft>" +
                                "  <MarginRight>1in</MarginRight>" +
                                "  <MarginBottom>0.5in</MarginBottom>" +
                                "  <DpiX>72</DpiX>" +
                                "  <DpiY>72</DpiY>" +
                                "</DeviceInfo>";
    Warning[] warnings;
    string[] streams;

    //Render the report
    byte[] renderedBytes = localReport.Render(
        reportType,
        deviceInfo,
        out mimeType,
        out encoding,
        out fileNameExtension,
        out streams,
        out warnings);

    File.WriteAllBytes("I:\\report.pdf", renderedBytes);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T13:54:51+00:00Added an answer on May 24, 2026 at 1:54 pm

    It took a few hours but I finally found what I had missed. If you check the properties on a report you can set “Variables” there which I’ve tested so many ways to create a match for the parameter coming from the main report. What I had totally missed (and couldn’t find described properly on the net) was that in the treeview on your right in the editor you have a folder called “Parameters”. I added a parameter there that corresponds to the one my main report is passing and now it works as it should!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a text area in my form which accepts all possible characters from
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a bunch of posts stored in text files formatted in yaml/textile (from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I used javascript for loading a picture on my website depending on which small
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.