I havenโt worked with GridView too much, and after you tricked him, find him more complex than I need, but missed out on some very basic abilities that I would expect from him. Undoubtedly, its implementation makes sense, given that its 90% of the time is associated with binding to a data set, especially declaratively, but I intend to bind it to IEnumerable<T>in the code.
I need the ability to easily do the following
- a) are tied to
IEnumerable<T>, where columns can be limited only by certain properties of the typeT - b) is requested to return a collection of its rows, where each row can have a cell that looked for a property that was bound to
in principle, something that implements the following interface would be nice
public interface IEasyGridBinder {
void Bind<T>(IEnumerable<T> bindableObjects, params string[] propertiesToBind);
IList<IDictionary<string, string>> Values {get;}
}
To get this, do I have to write my own custom EasyGridBinder that inherits from the GridView and implements this interface, or is there really a simple way to do this that I'm just not familiar with?
PS Bonus points if I can write something like
myGrid.Bind(myEntities, e=>{e.Id; e.Name; e.Customer.Name;});
But I suppose I can figure it out after reading the expressions
Follow-up question: Is there no way to get the raw data that was entered into gridview and not converted to html? If the field received as input contains an empty string, the cell seems to contain "" so is there no way to distinguish between entering an empty string and a space? If this is true, then I will probably return to the implementation of most of the GridView functions.