Programatically Examining Page Controls

Discussion in 'ASP .Net' started by Phil Sandler, Jun 11, 2008.

  1. Phil Sandler

    Phil Sandler Guest

    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
    Phil Sandler, Jun 11, 2008
    #1
    1. Advertising

  2. Phil Sandler

    clintonG Guest

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

    "Phil Sandler" <> wrote in message
    news:...
    > 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
    clintonG, Jun 11, 2008
    #2
    1. Advertising

  3. Phil Sandler

    Phil Sandler Guest

    On Jun 11, 2:25 pm, "clintonG" <> wrote:
    > 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
    Phil Sandler, Jun 11, 2008
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tim Williams

    examining 'self' in IDLE

    Tim Williams, Feb 4, 2004, in forum: Python
    Replies:
    0
    Views:
    249
    Tim Williams
    Feb 4, 2004
  2. Micah
    Replies:
    3
    Views:
    265
    Richie Hindle
    Aug 26, 2004
  3. Replies:
    9
    Views:
    447
  4. Robert P. J. Day
    Replies:
    4
    Views:
    345
    Lie Ryan
    Jan 20, 2010
  5. dotNetProfessional

    Examining Bind expressions at runtime

    dotNetProfessional, Oct 27, 2006, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    98
    dotNetProfessional
    Oct 27, 2006
Loading...

Share This Page