User-711950860 posted
Thank you for replay to my request
To solve my problem, I thought of something similar to
cso_Entities cso = new cso_Entities();
string filter = string.Empty;
//ID of the connected user
int appoId = 0;
int.TryParse(User.Identity.Name.ToString(), out appoId);
//Appezzamento of the connected user
var appezzamentos = from app in cso.Appezzamento.Include("Produttore").ToList()
where app.Produttore.UTE_Id == appoId
select app.APP_Id;
//create the filter
foreach (var app in appezzamentos)
{
filter += " || it.Appezzamento.APP_Id == " + app.ToString();
}
filter = filter.Substring(3);
//apply the filter
GridDataSource.AutoGenerateWhereClause = false;
GridDataSource.Where = filter;
This solution generate one error that refer to other entity in association with Appezzamento.
This is an example of the error:
<< Name of the parameter 'AnagraficaFasiFenologiche.AFF_Id' specified is invalid. The names of parameter must begin with a letter and can contain only letters, numbers and underscores. >>
I think that this happens because the parameters of the WhereParameters collection are not inserted
Thanks