Filter DropDownDataGrid

HI I'd like to filter the list that is populated in a dropdowndatagrid, for example only where rID > 10,
Currently the Data is set to ${getCustomersForCustomerIDResult}

Thanks
Xarion

using System.Linq;

${getCustomersForCustomerIDResult.Where(x => x.rID > 10)}
1 Like

Thanks Kim, how about a string comparison ?

${getCustomersResult.Where(x => x.rDescription != 'HELLO')}

its not compiling with the above.

In C# string should be declared with double quotes.

Thank you @enchev

I have written it like this but still getting an error

${getCustomersForCustomerIDResult.Where(x => !x.rDescription.Contains("HELLO"))}

error RZ9986: Component attributes do not support complex content (mixed C# and markup). Attribute: 'Data', text: '(getCustomersForCustomerIDResult.Where(x => !x.rDescription.Contains("HELLO")))

I've managed to resolve the problem, although using the same code as above so perhaps it was something else.

How can I apply this to a datagrid? I am using
${getSitesResult.Where(x => x.SiteType>1)}
for Data, giving me the following error on the page

and a compile error of:
error CS1061: 'SiteComponent' does not contain a definition for 'rID' and no accessible extension method 'rID' accepting a first argument of type 'SiteComponent' could be found (are you missing a using directive or an assembly reference?)

Xarion

It is recommended to apply the filtered result to a variable, then bind this variable to the DataGrid Data property. This will prevent the errors you're seeing.

Sorry to ask what might be a trivial question, but how and where would you define this variable as it wouldn't make sense to put it in the expression?

As it seems to me that you are missing the basic understandings of Radzen, I strongly advise you to follow their tutorial. Or you can go straight to the properties tutorial but this might take you back to this forum instead.