Table of Contents
- Getting Started
- EO.Pdf
- EO.Web
- Overview
- Installation & Deployement
- EO.Web ToolTip
- EO.Web Rating
- EO.Web Slider & RangeSlider
- EO.Web ListBox
- EO.Web ComboBox
- EO.Web Captcha
- EO.Web ASPX To PDF
- EO.Web Slide
- EO.Web Flyout
- EO.Web EditableLabel
- EO.Web ImageZoom
- EO.Web Floater
- EO.Web Downloader
- EO.Web ColorPicker
- EO.Web HTML Editor
- EO.Web File Explorer
- EO.Web SpellChecker
- EO.Web Grid
- EO.Web MaskedEdit
- EO.Web Splitter
- EO.Web Menu
- EO.Web Slide Menu
- EO.Web TabStrip
- EO.Web TreeView
- EO.Web TreeView
- Overview
- Using EO.Web TreeView
- TreeNode and TreeNodeGroup
- Look, Skin and Theme
- Style and Appearance
- Data Binding
- Handling Event
- EO.Web Calendar
- EO.Web Callback
- EO.Web MultiPage
- EO.Web Dialog
- EO.Web AJAXUploader
- EO.Web ProgressBar - Free!
- EO.Web ToolBar - Free!
- EO.WebBrowser
- EO.Wpf
- Common Topics
- Reference
Populating from IEnumerable |
Apply to
Overview
EO.Web navigation controls can populate from any objects that implements IEnumerable interface, such as Array and ArrayList. Since these objects do not represent a hierarchical data structure, binding to such data source does not populate multiple levels of navigation items. For example, if you bind an array to a Menu control, it will only populate the top level group.
Mapping data source object property to item's property
When binding to an object that implements IEnumerable, EO.Web navigation controls iterate through the enumerator, call ToString method on each object in the collection and use the result as navigation item's Text.Html property. You can override this default behavior by defining one or more DataBinding objects, which defines the mapping between the property of objects in IEnumberable collection and item's property. The following example uses Employee.Name as navigation item text:
public class Employee { private string _Name; private string _Position; public Employee(string name, string position) { _Name= name; _Position = position; } public string Name { get { return_Name;} } public string Position { get { return _Position; } } } menu1.DataSource = new Employee[]{ new Employee("John", "Developer"), new Employee("Sam", "Sales Manager")}; menu1.DataBind();
Note:
DataField is used to specify the source property name when the individual object is not an ADO.Net object.