Hi,
For my customer I'm appointed to see if LLBLGen Pro can replace their current framework.
So far it looks promising.
Currently I'm looking if I can replace their current generic filtering usercontrol.
I have some problems with it, I hope you can help me.
What I want:
Create a usercontrol where data can be filtered.
The usercontrol consist of some fields. For this example I will cut it down to 2:
- a dropdown list containing the properties of the object.
- a textfield where a value can be entered
and ofcourse the button
I want to create 2 properties on the usercontrol.
- One of the type CommonEntityBase where the entity type can be set to:
- and a property containing the result list
For test purposes I created a grid to see the result.
So far I have the following:
private CommonEntityBase _zoekObject = null;
public CommonEntityBase ZoekObject
{
get { return _zoekObject; }
set { _zoekObject = value; }
}
protected void Page_Load(object sender, EventArgs e)
{
//For test purposes just set the ZoekObject to an entity
this.ZoekObject = new FpsReden();
if (!Page.IsPostBack)
{
// Build the dropdown list
foreach (EntityField entiteit in _zoekObject.Fields)
{
ddlProperties.Items.Add(new ListItem(entiteit.Name, entiteit.Name));
}
//Add empty value to dropdown
ddlProperties.Items.Insert(0, new ListItem());
}
}
//Temporarily use a dirty method to retrieve the Entity field based upon string name
private EntityField getField(string name)
{
foreach (EntityField entiteit in _zoekObject.Fields)
{
if (entiteit.Name == name)
return entiteit;
}
return null;
}
//Ok let's try to filter the data
protected void btnFilter_Click(object sender, EventArgs e)
{
// Create filter
IPredicateExpression filter = new PredicateExpression();
// Add a filter expression to the filter -> TODO add multiple filter statements
FieldLikePredicate predicate = new FieldLikePredicate(this.getField(ddlProperties.SelectedValue), "%" + txtValue.Text + "%");
filter.Add(predicate);
// How to fill a collection without using FpsRedenCollection??
FpsRedenCollection reden = new FpsRedenCollection();
reden.GetMulti(filter);
RadGrid1.DataSource = reden;
RadGrid1.DataBind();
}
As you can see I have to use FpsRedenCollection to be able to execute the GetMulti().
IS there a way to execute GetMulti without using a hardcoded collection?
Looking forward to your reply.