473,320 Members | 1,910 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Programatically Examining Page Controls

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
Jun 27 '08 #1
2 933
Going about it is called reflection which is the term you want to research
and learn to use.

"Phil Sandler" <ps********@hotmail.comwrote in message
news:63**********************************@25g2000h sx.googlegroups.com...
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
Jun 27 '08 #2
On Jun 11, 2:25*pm, "clintonG" <nob...@nowhere.comwrote:
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
Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: John | last post by:
Hi, heres a brief description of what I'm trying to do. I have a sql table named colors that looks like this: color_id color_name 1 blue 2 red 3......... and so...
4
by: Andrea Williams | last post by:
Does anyone know of some in depth documentation regarding how to add user controls programatically? I have a User Control, which has some basic html controls, and depending on the number selected...
4
by: stb | last post by:
I have an empty asp:table on a form. Rows and cells in the rows are added programatically. At the end of each row, there is a cell with a button inside it. How do I catch the button's click...
2
by: Alex Nitulescu | last post by:
Hi. I have a web.config which says that all files with the "axd" extension should by a special handler. The handler writes some stats to the "axd" page. Public Class WhosOnHandler Implements...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.