Programatically Examining Page Controls

  • Thread starter Thread starter Phil Sandler
  • Start date Start date
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
 
Going about it is called reflection which is the term you want to research
and learn to use.
 
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
 
Back
Top