I need to loop through all controls on ASP.NET webpage. In configuration file I have a list of control types and their properties which will I handle in some way. Now, I am interested in following: how can I get that needed property, when all I have are strings, ie names of types of controls and names of their respective properties.
Here is example: In config file I have strings:
controltype = "label" propertyname = "Text"
controltype = "Image" propertyname = "ToolTip".
so I have something like this in my code:
List<Control> controls = GiveMeControls();
foreach(Control control in controls)
{
// in getPropertyNameFromConfig(control) I get typename of control
// and returns corresponding property name from config type
string propertyName = getPropertyNameFromConfig(control);
string propertyValue = getPropertyValueFromProperty(control, propertyValue);
// !!! Don't know how to write getPropertyValueFromProperty.
}
Does anyone have any idea how to develop getPropertyValueFromProperty()?
Thanks in advance,
DP