I need to skip the properties of the custom object type that I am returning from the database and show only the columns containing the data. This means that I cannot just bind a list of objects to a datagrid. I do not want to iterate over each object and see if the / null column is empty and determine its display in the user interface. What I think is in my business layer, before sending the object back, I would send IEnumerable back with only those columns that should be visible. So I was thinking about using Linq for Object for this, but I'm not sure if it will be very beautiful.
Does anyone know of a solution that I could use without a ton of IF statements that I could do to check a large object (about 30 columns) to determine what should be displayed or not.
Foreach (CustomerData customerdata in Customers) { if (!customerdata.address.Equals("")) { dgvCustomerData.Column["Address"].visible = false; }
I want to avoid all this in the user interface and all IFs ... I have a brain fart on this, can anyone help me?
thanks
source share