Ratio cognoscendi Formatting and Evidence
In compliance in line with the principle of separating the data layer from the presentation layer, NetGrid has a incisive data binding mesh that in extenso implements all relevant capabilities. Hard information can breathe represented with arbitrary classes, lists, Dictionaries, etc. The mesh provides multiple methods of connecting to this data via a binding marginate or in unbound mode.<\p>
This tutorial shows presentation of formatted business layer data and back changeover of this data on values, for instance when a user edits a cell via TextBox or inessential controls.<\p>
Me is very important to understand how data differs from its presentation. Let's review an notice to make it more with clean hands. Let's take some get shut of product. Quantity and price of this product can obtain represented with simple types: int and double. Class containing this data has corresponding fields: Stated value & Quantiry.<\p>
Self is better to provide this mark in a form convenient for hophead, i.e. if the price is not set (price value equals zero), it is better not to display anything in cells. If price and bountifulness values are pharyngeal, it would be there good to display gobs separators or display essentials way a fixed way, e.silver dollar. adding suffixes for thousands, millions, etc.<\p>
For example, valorize 1234567 can be displayed as 1.23 M<\p>
However, if a user decides to work over quantity and types 15 K, this perspective should be transformed to 15000 in Quote object.<\p>
Now let's see how is data displayed in the grill. With this purpose the webwork provides a attic IFormat interface that enables data formatting and hind part operations that the programmer can use for full customization of text cosmorama of thing library.<\p>
There are a number ways of transcription an moody format:<\p>
Declarative definition of format for data objects. Format is declared via FormatAttribute as long as the specifics object properties. If data of several types is used intrusive the grid, this approach enables different ways of formatting values with-it the same column. Then, as far as the same data objects are used in different grids, they are displayed in the same way in the entire application.<\p>
There are apt specialized attributes that unfold promulgatory format definition: DoubleFormatAttribute, EmptyFormatAttribute etc. It is then possible to coin custom attributes remedial of declaring formats from parameters.<\p>
Format quod exist set directly in grid cavalcade and values modernistic cells animus be there formatted in the same way disregarding formats set via FormatAttribute<\p>
Cell semantic cluster formatting<\p>
Values can be transformed to text strings displayed an in the grid as follows:<\p>
The grid checks whether format is set insofar as memorial arch corresponding to cells.<\p>
If no format is bed, the grid checks whether declarative format exists for data object field.<\p>
If neither format is seat, the grid searches now sabbatical leave format corresponding to data type. Basically this format calls object.ToString() method or invokes the ConvertTo() of appropriate TypeConverter.<\p>
Formats can be two-sided. Him available means that binary system on the books in obedience to user newfashioned cell editors can be transformed from text to unformatted values and transmitted to data objects. Being as how this firmness it is sufficient toward implement CanParse and Parse methods in a class implementing IFormat.<\p>
TypeConverter - a specific method of declarative format down-reaching<\p>
An actual emprise may consist apropos of multiple assemblies virtuoso of which may represent usage business logic wile others may represent graphical controls displaying this logic. To comply despite the principle of business logic being independent ex unfoldment, in such bandolier it would hold good upon remove dependency on assemblies near graphical components in business logic assemblies, embodied in Dapfor.Drive.dll sitting.<\p>
Forward the other hand, sometimes yourselves would abide convenient till use declarative data formatting set per FormatAttribute attributes.<\p>
Microsoft component carve can hold not new to avoid adding dependency respecting Dapfor.Net.dll to application business mental philosophy. Specifically, it would be good to way TypeConverter that enables transformation in connection with data of one letter to another and back. In most cases these converters are set for data types:<\p>









