joeharrison714 / MVCGrid.Net

http://mvcgrid.net
MIT License
75 stars 56 forks source link

WithRowCssClassExpression #185

Open barrufeto opened 5 years ago

barrufeto commented 5 years ago

Hi.

Us possible to assign this property reading a property from a table in the database? A query executed there...or a from a session value,

Thanks!

barrufeto commented 5 years ago

I'll explain better now with my laptop...

We have something like this in the code:

WithRowCssClassExpression(x => (x.Enabled == true) ? "info" : "danger" )

And it works fine accessing the info defined in the line MVCGridDefinitionTable.Add("InOutUserGrid", new MVCGridBuilder()

Now..imagine we want to write the condition of the WithRowCssClassExpression accessing our BD (with Entity Framework) and the idea is execute something like:

WithRowCssClassExpression("SQL Query to get the Enabled property of the register" == true) ? "info" : "danger" )

I want to do this because in the view I use (vst_InOut), I don't want to create a complex SQL sentence.

Thanks!