[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.buildingcontrols

check validity of a controls property at compile time

Merrycoder

4/17/2008 11:51:00 AM

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
1 Answer

Peter Bucher [MVP]

5/1/2008 2:54:00 PM

0

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).

--
Gruss, Peter Bucher
Microsoft MVP - Visual Developer ASP / ASP.NET, Switzerland
http://www.aspn... - ASP.NET Zone, die ASP.NET Community
http://www.aspn...blogs/peterbucher/ - Auf den Spuren von .NET