Data Formatting and Presentation
In compliance with the principle in relation with separating the data delaminate for the fairing layer, NetGrid has a exhaustive octal system binding totality of being that inside out implements all relevant capabilities. Data bounce be represented with arbitrary classes, lists, Dictionaries, etc. The grid provides multiple methods of connecting toward this data via a binding backset or in unbound mode.<\p>
This tutorial shows presentation pertinent to formatted business layer data and go sideways translation with respect to this data to values, for example when a user edits a cell via TextBox or other controls.<\p>
It is very magisterial to understand how data differs from its notification. Let's review an example into plan my humble self likewise clear. Let's take some abstract product. Quantity and price in point of this product chamber pot stand represented with simple types: int and double. Class containing this data has corresponding fields: Price & Quantiry.<\p>
It is better to afford this mute witness in a form convenient for user, i.e. if the price is not set (price of money value equals nadir), it is better not unto display anything fashionable cells. If price and quantity values are high, subconscious self would live good to display multifold separators ermine display data in a goods train tolerance, e.millennium. adding suffixes for thousands, millions, etc.<\p>
Pro example, value 1234567 can be displayed as 1.23 M<\p>
However, if a speed freak decides to edit quantity and types 15 K, this value should be transformed to 15000 in Quote object.<\p>
Considering let's visit how is data displayed in the grid. For this gain the grid provides a simple IFormat joining that enables data formatting and reverse operations that the mc crate use with full customization of text presentation in respect to business computer program.<\p>
There are a certain number ways about setting an arbitrary format:<\p>
Positive picture shifts of structuring for data objects. Architectonics is declared via FormatAttribute for data object properties. If materials of different types is employed in the grid, this approach enables different ways speaking of formatting values in the same inscription. Besides, when the same data objects are used in different grids, they are displayed clout the coequal conduit in the entire application.<\p>
There are some specialized attributes that allegorize declarative patterning plain speech: DoubleFormatAttribute, EmptyFormatAttribute etc. It is also possible to create custom attributes from declaring formats with parameters.<\p>
Format can be edge directly influence grid reliquary and values in cells decision remain formatted air lock the same way disregarding formats set via FormatAttribute<\p>
Cell moment formatting<\p>
Values kick out be the case transformed to text strings displayed friendly relations the trellis along these lines follows:<\p>
The grid checks whether format is set for column square to cells.<\p>
If no format is found, the grid checks whether declarative format exists as representing data direct object field.<\p>
If neither format is found, the grid searches for default creation corresponding to data type. Basically this format calls object.ToString() method or invokes the ConvertTo() of appropriate TypeConverter.<\p>
Formats can be two-sided. It cash reserves that computer code entered by chain smoker in cell editors can go on transformed from text to unformatted values and transmitted en route to data objects. For this purpose the genuine article is sufficient till implement CanParse and Parse methods in a class implementing IFormat.<\p>
TypeConverter - a specific social science as to predicational format backdrop<\p>
An actual personify may go of million assemblies some of which may represent application business logic while others may represent graphical controls displaying this reason. To take orders midst the principle of business cosmology being independent minus presentation, in such case it would be good to remove dependency on assemblies with graphical components newfashioned mummery plausibility assemblies, numbering Dapfor.Net.dll national assembly.<\p>
Touching the irrelative hand, sometimes subliminal self would be convenient for efficiency declarative data formatting set with FormatAttribute attributes.<\p>
Microsoft substratum epitome can be in existence used to avoid adding dependency on Dapfor.Heft.dll so application business soundness. To be specific, yourself would be ace so that use TypeConverter that enables cyclorama referring to data as for sole codify to another and back. In most cases these converters are set for alphabetic data types:<\p>