Get all Control objects from a .DLL associated with an ASP.NET page?

  • Thread starter Thread starter Peter
  • Start date Start date
P

Peter

I am trying to get all the control objects using C# code that resides in a
..DLL
that my ASP.NET page uses. However I can't seem to get a list of all the
controls associated with my ASP.NET page. I have tried the following:

this.Controls
this.Page.Controls
this.Parent.Controls

and came up empty. Anyone have any suggestions if this is possible and if so
what
the magic incantation is????
 
One of the problem might be timing.
You probably calling this.Page.Controls before that collection has been populated.
Check the Page.EnsureChildControls

might be what you need


Also you are scarring me when saying
"I am trying to get all the control objects using C# code that resides in a .DLL"
What DLL and how it got access to the Page object?

George.

I am trying to get all the control objects using C# code that resides in a
.DLL
that my ASP.NET page uses. However I can't seem to get a list of all the
controls associated with my ASP.NET page. I have tried the following:

this.Controls
this.Page.Controls
this.Parent.Controls

and came up empty. Anyone have any suggestions if this is possible and if so
what
the magic incantation is????
 
Okay I'll check it out. As for the DLL it is one that I am referencing (after using
the ASP.NET import statement, which I placed) in the /wwwroot/bin directory.
One of the problem might be timing.
You probably calling this.Page.Controls before that collection has been populated.
Check the Page.EnsureChildControls

might be what you need


Also you are scarring me when saying
"I am trying to get all the control objects using C# code that resides in a .DLL"
What DLL and how it got access to the Page object?

George.

I am trying to get all the control objects using C# code that resides in a
.DLL
that my ASP.NET page uses. However I can't seem to get a list of all the
controls associated with my ASP.NET page. I have tried the following:

this.Controls
this.Page.Controls
this.Parent.Controls

and came up empty. Anyone have any suggestions if this is possible and if so
what
the magic incantation is????
 

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

Back
Top