Getting the value of a public virtual property from an assembly

OK.  Here goes.

I have a user control that gets all its properties from another user control.  

<%@ Control Language="C#" AutoEventWireup="true"
    Inherits="CMSWebParts_Polls_PollRaceTrac" CodeFile="~/CMSWebParts/Polls/PollRaceTrac.ascx.cs" %>
<%@ Register Src="~/CMSModules/Polls/Controls/View/PollView.ascx" TagName="PollView" TagPrefix="cms" %>
<cms:PollView ID="viewPoll" runat="server" />

The PollView.ascx has a data container called PollInfo.  PolllInfo is an assembly with a namespace as follows:

namespace CMS.Polls
{
    // Summary:
    //     PollInfo data container class.
    public class PollInfo : AbstractInfo<PollInfo>

PollView.ascx also has a protected reference to the PollInfo data container
defined as follows:  protected Pollinfo pi = null;
Then PollInfo fills up with the data from the UI

Contained within the PollInfo object are some public virtual properties.  Many are exposed as properties on the PollView.ascx, but one of them that I need is not exposed.  PollOpenTo is the property defined as follows in the PollInfo class  
public virtual DateTime PollOpenTo { get; set; }

Since the accessor is protected I can see all the properties that are contained in the PollInfo.  so I thought I could go
if (viewPoll.pi.PostOpenTo <= DateTime.Now)
Do something

This statement is throwing an object reference not set error.  

What can't I read this value?
Document2.txt
sherbug1015Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bob LearnedCommented:
There are 2 candidates for null reference:

1) viewPoll

2) pi

I can see where you are declaring the "pi" property, but I can't see where you are creating the instance:

 protected PollInfo pi = null;

The "protected" keyword means that the property is only visible to inheriting classes.  I can't quite make out the class hierarchy and inheritance.
0
sherbug1015Author Commented:
OK.  Thanks.  I was able to solve this myself.  The software I am using has a bunch of Api and I was able to drill down to the field I needed.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sherbug1015Author Commented:
The software I am using has a lot of API that I found and was able to drill down and get the field I needed from there

DateTime PollClosed = new DateTime(1900, 01, 01);
        var activePolls = PollInfoProvider.GetPolls("PollID = 5", "");
        foreach (PollInfo pi in activePolls)
        {
            PollClosed = pi.PollOpenTo;
        }
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.