Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / MIT / System / Web / UI / MobileControls / Adapters / HtmlListAdapter.cs / 1305376 / HtmlListAdapter.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- using System; using System.IO; using System.Web; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.MobileControls; using System.Security.Permissions; using System.Globalization; #if COMPILING_FOR_SHIPPED_SOURCE namespace System.Web.UI.MobileControls.ShippedAdapterSource #else namespace System.Web.UI.MobileControls.Adapters #endif { /* * HtmlListAdapter provides the html device functionality for List controls. * * Copyright (c) 2000 Microsoft Corporation */ ///[AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)] [AspNetHostingPermission(SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal)] [Obsolete("The System.Web.Mobile.dll assembly has been deprecated and should no longer be used. For information about how to develop ASP.NET mobile applications, see http://go.microsoft.com/fwlink/?LinkId=157231.")] public class HtmlListAdapter : HtmlControlAdapter { /// protected new List Control { get { return (List)base.Control; } } /// public override void Render(HtmlMobileTextWriter writer) { if(Control.HasControls()) { RenderChildren(writer); return; } RenderList(writer); } /// protected virtual void RenderList(HtmlMobileTextWriter writer) { MobileListItemCollection items = Control.Items; Wrapping wrap = Style.Wrapping; // used for tables, no decoration case. if (items.Count == 0) { return; } int pageStart = Control.FirstVisibleItemIndex; int pageSize = Control.VisibleItemCount; // Determine what markup to use. String listSuffix, itemPrefix, itemSuffix; ListDecoration decoration = Control.Decoration; bool insideStyle = true; // We know that for table tag, outer style doesn't carry over // into inside tags so style state needs to be reset. // For other cases, we enter the style here once and exit at the // end once. if (decoration != ListDecoration.None || !Device.Tables) { writer.EnterStyle(Style); insideStyle = false; } switch (decoration) { case ListDecoration.Bulleted: writer.WriteLine("
- ");
listSuffix = "
"; } break; case ListDecoration.Numbered: if (pageStart == 0) { writer.WriteLine("
- ");
}
else
{
writer.Write("
- "; itemSuffix = " "; if (!Device.RendersBreaksAfterHtmlLists) { listSuffix += "
- ");
}
listSuffix = "
"; } break; default: if (Device.Tables) { listSuffix = ""; Style.Wrapping = Wrapping.NotSet; writer.EnterLayout(Style); writer.WriteLine("