Enhanced System.Web.UI.WebControls.DataList control with Pagination and rendering according to the device capabilities.
Namespace: FiftyOne.Framework.Mobile.ControlsAssembly: FiftyOne.Framework (in FiftyOne.Framework.dll) Version: 2.0.2.1 (2.0.2.1)
Syntax
| C# |
|---|
[ToolboxBitmapAttribute("FiftyOne.Framework.Mobile.Controls.DataList")] [ControlValuePropertyAttribute("SelectedValue")] [EditorAttribute("System.Web.UI.Design.WebControls.DataListComponentEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(ComponentEditor))] [AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)] public class DataList : DataList, IStyle, IUrlResolutionService, ICssIncludeGroup |
| Visual Basic |
|---|
<ToolboxBitmapAttribute("FiftyOne.Framework.Mobile.Controls.DataList")> _ <ControlValuePropertyAttribute("SelectedValue")> _ <EditorAttribute("System.Web.UI.Design.WebControls.DataListComponentEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", _ GetType(ComponentEditor))> _ <AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level := AspNetHostingPermissionLevel.Minimal)> _ Public Class DataList _ Inherits DataList _ Implements IStyle, IUrlResolutionService, ICssIncludeGroup |
| Visual C++ |
|---|
[ToolboxBitmapAttribute(L"FiftyOne.Framework.Mobile.Controls.DataList")] [ControlValuePropertyAttribute(L"SelectedValue")] [EditorAttribute(L"System.Web.UI.Design.WebControls.DataListComponentEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(ComponentEditor))] [AspNetHostingPermissionAttribute(SecurityAction::InheritanceDemand, Level = AspNetHostingPermissionLevel::Minimal)] public ref class DataList : public DataList, IStyle, IUrlResolutionService, ICssIncludeGroup |
Examples
The following code example demonstrates how to use a DataList and Pager controls to display a list of items from a data source.
<mob:Pager ID="Pager1" runat="server" ControlToBind="ItemsList" PagerMode="Numeric" /> <mob:DataList id="ItemsList" AllowPaging="true" PageSize="5" PagingMode="RowsPerPage" BorderColor="black" CellPadding="5" CellSpacing="5" runat="server" onpageindexchanging="ItemsList_PageIndexChanging" > <HeaderStyle BackColor="#aaaadd" /> <AlternatingItemStyle BackColor="Gainsboro" /> <HeaderTemplate> List of items </HeaderTemplate> <ItemTemplate> Description: <mob:Label runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "StringValue") %>' /> Price: <mob:Label runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "CurrencyValue", "{0:c}") %>' /> <mob:Image id="ProductImage" AlternateText="Product picture" ImageUrl='<%# DataBinder.Eval(Container.DataItem, "ImageValue") %>' runat="server"/> </ItemTemplate> </mob:DataList>
protected void Page_Load(object sender, EventArgs e) { BindData(); } private void BindData() { ItemsList.DataSource = CreateDataSource(); ItemsList.DataBind(); } protected void ItemsList_PageIndexChanging(object source, FiftyOne.Framework.Mobile.Controls.PageEventArgs e) { ItemsList.PageIndex = e.NewPageIndex; BindData(); } private ICollection CreateDataSource() { // Create sample data for the DataList control. DataTable dt = new DataTable(); DataRow dr; // Define the columns of the table. dt.Columns.Add(new DataColumn("IntegerValue", typeof(Int32))); dt.Columns.Add(new DataColumn("StringValue", typeof(String))); dt.Columns.Add(new DataColumn("CurrencyValue", typeof(double))); dt.Columns.Add(new DataColumn("ImageValue", typeof(String))); // Populate the table with sample values. for (int i = 0; i < 20; i++) { dr = dt.NewRow(); dr[0] = i; dr[1] = "Description for item " + i.ToString(); dr[2] = 1.23 * (i + 1); dr[3] = "Image" + i.ToString() + ".jpg"; dt.Rows.Add(dr); } DataView dv = new DataView(dt); return dv; }
Inheritance Hierarchy
System..::..Object
System.Web.UI..::..Control
System.Web.UI.WebControls..::..WebControl
System.Web.UI.WebControls..::..BaseDataList
System.Web.UI.WebControls..::..DataList
FiftyOne.Framework.Mobile.Controls..::..DataList
System.Web.UI..::..Control
System.Web.UI.WebControls..::..WebControl
System.Web.UI.WebControls..::..BaseDataList
System.Web.UI.WebControls..::..DataList
FiftyOne.Framework.Mobile.Controls..::..DataList