Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Accessing a property by name
Message
From
22/11/2003 14:26:40
 
 
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00852561
Message ID:
00852665
Views:
16
Take a look at Rick Strahl's (great) article on ASP Data Binding (http://www.west-wind.com/presentations/aspnetdatabinding/aspnetdatabinding.asp). In it he demonstrates the use of his wwUtils -class that he wrote to do just what you are looking for.

Setting a property using this class is as simple as this:

wwUtils.SetProperty(object, propertyname, value)

e.g.,

wwUtils.SetProperty(this,"Customer.Address.Street","32 Kaiea")

This method is a reflection wrapper that makes this operation very simple and intuitive. You could of course use "raw" Reflection, if you like typing and want to do it the hard way <g>.




>If I have string specifying the name of a property, how can I use that information to access that property, i.e. store a value to, or retrieve a value from that property?
>
>Thengew.
Pertti Karjalainen
Product Manager
Northern Lights Software
Fairfax, CA USA
www.northernlightssoftware.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform