Programatically Examining Page Controls

P

Phil Sandler

All,

I am trying to build a program that collects some metadata from my
Asp.net application. I want to collect properties of a few specific
types of controls that are used on a number of pages. The properties
are set declaratively (on the aspx page itself), so just creating an
instance of the class (code-behind) won't do it.

I was able to get all pages in the application using reflection, but
using CreateInstance resulted in pages that did not have any controls.

As a basic example, assume I want to collect information about all
label controls on all pages of my application. I want to collect each
of their "Text" properties, which are set on the aspx page.

So I guess the first step is being able to create an instance of a
page as if it were created via the asp.net framework (i.e. it is
created using the declarative info on the aspx page), then drill into
the controls and find controls of a given type(s) and collect the
information.

Any idea if this is possible, and how to go about it?

Thanks for any insight.


Phil
 
C

clintonG

Going about it is called reflection which is the term you want to research
and learn to use.
 
P

Phil Sandler

Going about it is called reflection which is the term you want to research
and learn to use.

As I said in my original post, I can use reflection to get each page
and instantiate it, but I need to instantiate it in the context of the
the asp.net framework (with all declarative property settings from the
aspx file), which is what I'm asking how to do.

So reflection by itself is not the answer.


Thanks,

Phil
 

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

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,040
Latest member
papereejit

Latest Threads

Top