User Control reference from aspx to C# ?

M

mAbZ

I have trouble getting an object reference from aspx in c# code.
I have 2 User Controls created in an aspx page:

....
<MyNamesp:MyControl1 ID="ctrl1" runat="server" ParentWindow="<%# this %>" />
<MyNamesp:MyControl2 ID="ctrl2" runat="server" Args="<%# ctrl1 %>" />
....

I also have 2 corresponding classes with their public properties
ParentWindow and Args respectively.

The objects "this" and "ctrl1" are instantiated but while
debugging I see that their values in each property setter are null.
The instantiated object "stays" so to speak on the aspx page.
Why? I would appreciate any ideas.

P.S.
Instatiating those objects in C# instead is working but not an option,
I need to do it like above.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,815
Latest member
treekmostly22

Latest Threads

Top