Setting user control custom class from parent page

Hi Experts

I have the following class in wuc_Test.ascx
public static class tblProps
    {
        public static string[] _arrH;
        public static string[] _arrC;
        public static class _ctlV
        {
            public static bool _blnV;
            public static int _posV;
        }
        public static class _ctlE
        {
            public static bool _blnE;
            public static int _posE;
        }
        public static class _ctlD
        {
            public static bool _blnD;
            public static int _posD;
        }
    }

Open in new window

On the aspx page, I have the directive:
<%@ Register src="wuc_Test.ascx" tagname="wuc_Test" tagprefix="uc1" %>

Open in new window

On the aspx.cs page, I'm adding the ascx dynamically:
protected void addWuc_Test()
    {
        wuc_Test wuc_Test1 = new wuc_Test();

        pnlPrnt.Controls.Clear();
        pnlPrnt.Controls.Add(wuc_Test1);
    }

Open in new window

how can I access the class from the aspx.cs page ? something similar to the following:
wuc_Test1.tblProps._arrH  = {};
wuc_Test1.tblProps._ctlV._blnV = true;

Many thanks.
Faraj1969System AdministratorAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
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.

Kyle AbrahamsSenior .Net DeveloperCommented:
Don't make the class static:
public class tblProps

in the ascx create an instance of the class, with a public property.
tblProps _tProp = new tblProps();

public tblProps tProp
{
get
{
   return _tProp ;
}
set 
{
   _tProp = value;
}
}

Open in new window


then in the aspx:
wuc_Test1.tProp._ctlV._blnV = true;
0
Faraj1969System AdministratorAuthor Commented:
In the aspx.cs, a red line under _ctlV and an error message says: '_ctlV': cannot reference a type through an expression.
0
Kyle AbrahamsSenior .Net DeveloperCommented:
remove static from each of the classes, in your main class constructor create instances of the other classes, exposing them as properties.
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
Faraj1969System AdministratorAuthor Commented:
Many thanks mate, direct to the point.
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
C#

From novice to tech pro — start learning today.