check validity of a controls property at compile time

M

Merrycoder

I'm trying to check the validity of a server controls property at compile
time. Let's say I have my control embedded in a page like so:

<cc1:MyControl ID="MyControl1" TheObject="<%# oPerson %>"
PropertyName="FirstName" runat="server" />

The control's property references the page level object instance oPerson.
What I would like to do is to find out the type of the field 'oPerson' and if
it has a property 'FirstName'. If not, compilation should fail. I have been
playing around with a custom ControlBuilder but with no success.

Does anyone have a solution? My eternal gratefulness would be yours :)

Regards
Stefan
 
P

Peter Bucher [MVP]

Hello Stefan
The control's property references the page level object instance oPerson.
What I would like to do is to find out the type of the field 'oPerson' and
if
it has a property 'FirstName'. If not, compilation should fail. I have
been
playing around with a custom ControlBuilder but with no success.
There is AFAIK no way to do that with out-of-the-box solutions.
As you assumed, it will only work, if you compile the whole thing like the
ASP.NET
Engine does, because of the templating / databinding stuff itself is located
on this layer (Compilation-Layer).
 

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

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,699
Latest member
AnneRosen

Latest Threads

Top