ListView Specification


ListView Specification

The ListView control exposes a DataSource property, which is a characteristic of all data-bound controls. The DataSource property is typed as an Object and accepts any object whose type implements either the System.Collections.IEnumerable or System.ComponentModel.IListSource interface as a valid data source. This requirement allows the page developer to use various types of objects as valid data sources. These types include ArrayList , DataView , DataSet , Data ­Reader and arbitrary arrays and collections. The ListView control enumerates the objects in the data source that it is bound to and creates a child control hierarchy for each enumerated object that is rendered, thus generating a visual representation of the data.

The ListView control implements the same explicit data-binding model used by the standard ASP.NET data-bound controls. This implies that the ListView control uses only its assigned data source to enumerate data when the page developer calls the DataBind method. The explicit data-binding model allows Web applications to optimize data access logic. This model allows the page developer to determine whether and when the ListView control should access its data source and build its control hierarchy. The ListView control also stores information in view state, which allows the control to re-create the control hierarchy during postbacks without requiring an actual instance of the data source. This further reduces the amount of data access that a Web application needs to perform, which in turn improves performance.

The ListView control allows the page developer to customize the rendering it creates through style and template properties. The page developer can use templates to define the structure and layout as well as the content and controls used to generate the rendering of each object in the data source. These templates are repeated for each object that is enumerated in the data source. The page developer can also use one or more of the style properties exposed by the ListView control to customize the visual appearance and formatting of the rendering. Together, these properties allow the page developer to incorporate the ListView control and blend it seamlessly into the rest of the Web application's UI.

Finally, the ListView control is associated with a custom designer, ListViewDesigner , which allows the control to offer a rich experience in a design-time environment such as Microsoft Visual Studio .NET. The designer allows you to select data sources and modify the content of the template properties at design time. In addition, the designer generates a WYSIWYG representation of the control by using a sample data source.



Developing Microsoft ASP. NET Server Controls and Components
Developing Microsoft ASP.NET Server Controls and Components (Pro-Developer)
ISBN: 0735615829
EAN: 2147483647
Year: 2005
Pages: 183

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net