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 439993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T20:49:42+00:00 2026-05-12T20:49:42+00:00

I have an RDLC report that I am rendering directly to the Response Stream

  • 0

I have an RDLC report that I am rendering directly to the Response Stream as PDF (rather than using the ReportViewer). In the code that renders the report, it’s DataSource is bound to a List(Of ClassA) objects defined in a custom assembly. This seems to work for the most part. My problem is that I can’t seem to handle the situation where a nested object is null. For example, given ClassA and ClassB (the nested object) defined as follows:

    Public Class ClassA
       Public Id As Integer
       Public Name As String
       Public TheNestedObject As ClassB
    End Class

    Public Class ClassB
       Public Id As Integer
       Public Name As String
       Public TheParentObject As ClassA
    End Class

Whenever I try to conditionally display an “N/A” if Class B is null in my expression as follows:

=IIf(IsNothing(Fields!TheNestedObject.Value,"n/a", Fields!TheNestedObject.Value.Name))

the report displays “#Error” if TheNestedObject is null. If TheNestedObject is not null, it correctly displays the Name.

What am I doing wrong here?

Thanks!!!

  • 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-12T20:49:42+00:00Added an answer on May 12, 2026 at 8:49 pm

    The iif function evaluates all arguments and thus Fields!TheNestedObject.Value.Name gets evaluated and gives the error since Fields!TheNestedObject.Value is null.

    I ended up adding some custom code to the report. It’s under report properties -> Code tab.

    Public Function GetName(ByRef obj As Object) As String
        If obj Is Nothing Then
            Return "n/a"
        Else : Return obj.Name
        End If
    End Function
    

    And then your textbox expression is:

    =Code.GetName(Fields!TheNestedObject.Value)
    

    The function returns “n/a” when it’s null and the Name property when it’s not.

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

Sidebar

Related Questions

In Microsoft ReportViewer Web server control I have a report in RDLC that binds
I have a .rdlc report and it has matrix. that matrix has some money
I have an application that makes use of Report Viewer and Report (.rdlc) files.
I have an rdlc report that displays a table of values. The way the
I have an RDLC report with a sub-report that I want to be A4
I have a reporting services report that was designed in VS2010. When using 'front
I have a rdlc report that takes as a ReportDataSource a List<BaseClass> . BaseClass
I have a line chart in a report (rdlc), that I cannot get formatted
I have a RDLC report which has a table, calling a subreport N times.
I have a client report (rdlc) and want to repeat some textboxes in every

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.