Here's what I ended up with :
if (this.datasource != null)
{
var y = (T)this.datasource;
var propList = typeof(T).GetProperties();
//try to assign the prop but it might be on a child-prop.
try
{
retour = DataBinder.Eval(y, propriete.Name).ToString();
}
catch
{
foreach (PropertyInfo prop in propList)
{
if ((prop.PropertyType).FullName.Contains("Env."))
{
var childPropList = prop.PropertyType.GetProperties();
foreach (PropertyInfo childProp in childPropList)
{
if (((System.Reflection.MemberInfo)(childProp)).Name == propriete.Name)
{
var x = DataBinder.GetPropertyValue(y, prop.Name);
retour = DataBinder.Eval(x, propriete.Name).ToString();
}
}
}
}
}
}
For now it works, but it might not be versatile enough in a near future.