Issue : When the filtering operation is performed based on the complex filed to the DataSource, Error has been thrown
Requirement : Need to get the Data type of the complex field attribute So that i can do the filtering operation on that Data Source.
I have defined my performFiltering Method as follows and it has two arguments
First argument : DataSource As IEnumerable Second argument : FilteredColumn as List
DataSource Holds the following data,
Order
{
OrderID : Long
EmployeeID : String
Employee : Info
}
Info
{
Address : String
}
and the "FilteredColumn" holds the following data
In this above pic, Field is set as Employee.Address, So i need to filter the Order DataBase Based on the Address Field.
How to get the Data Type of Address which is present inside in the Info class.
I have tried with the following way
string[] splits = filteredColumn.Field.Split('.');
var prop = dataSource.AsQueryable().ElementType.GetProperties();
Type type = null;
object value = null;
foreach (var pro in prop)
{
if (splits.Length == 1)
{
if (pro.Name == filteredColumn.Field)
type = pro.PropertyType;
}
else
{
foreach (string split in splits)
{
if(pro.Name == split)
type = pro.PropertyType;
}
}
}
But I cannot able to get the Address data Type.
Could you please figure out my mistake in the above code block.
Aucun commentaire:
Enregistrer un commentaire