Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / MIT / System / Web / UI / MobileControls / Adapters / XhtmlAdapters / XhtmlBasicListAdapter.cs / 1305376 / XhtmlBasicListAdapter.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- using System; using System.Globalization; using System.Security.Permissions; using System.Web.Mobile; using System.Web.UI.MobileControls; using System.Web.UI.MobileControls.Adapters; #if COMPILING_FOR_SHIPPED_SOURCE namespace System.Web.UI.MobileControls.ShippedAdapterSource.XhtmlAdapters #else namespace System.Web.UI.MobileControls.Adapters.XhtmlAdapters #endif { ///[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 XhtmlListAdapter : XhtmlControlAdapter { /// protected new List Control { get { return base.Control as List; } } /// public override void Render (XhtmlMobileTextWriter writer) { if (Control.HasControls()) { ConditionalRenderOpeningDivElement(writer); RenderChildren (writer); ConditionalRenderClosingDivElement(writer); return; } if (Control.Items.Count != 0) { ClearPendingBreakIfDeviceBreaksOnBlockLevel(writer); // we are writing a block level element in all cases. } ConditionalEnterLayout(writer, Style); RenderList (writer); ConditionalExitLayout(writer, Style); } /// protected virtual void RenderList (XhtmlMobileTextWriter writer) { MobileListItemCollection items = Control.Items; if (items.Count == 0) { return; } ListDecoration decoration = Control.Decoration; // Review: Consider replacing switch. switch (decoration) { case ListDecoration.Bulleted: RenderBulletedList (writer); break; case ListDecoration.Numbered: RenderNumberedList (writer); break; default: if (!Device.Tables) { RenderUndecoratedList(writer); return; } RenderTableList (writer); break; } } private void RenderBulletedList (XhtmlMobileTextWriter writer) { RenderOpeningListTag(writer, "ul"); RenderListBody (writer, "
" : "
"; if((string)Device["usePOverDiv"] == "true") br = "
"; RenderListBody (writer, "", br); } private void RenderListItem (XhtmlMobileTextWriter writer, MobileListItem item) { String accessKey = GetCustomAttributeValue(item, XhtmlConstants.AccessKeyCustomAttribute); String cssClass = GetCustomAttributeValue(item, XhtmlConstants.CssClassCustomAttribute); if (Control.ItemsAsLinks) { RenderBeginLink (writer, item.Value, accessKey, Style, cssClass); writer.WriteEncodedText (item.Text); RenderEndLink (writer); } else if (Control.HasItemCommandHandler) { RenderPostBackEventAsAnchor (writer, item.Index.ToString(CultureInfo.InvariantCulture) /*event argument*/, item.Text /*link text*/, accessKey, Style, cssClass); } else { writer.WriteEncodedText (item.Text); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
using System;
using System.Globalization;
using System.Security.Permissions;
using System.Web.Mobile;
using System.Web.UI.MobileControls;
using System.Web.UI.MobileControls.Adapters;
#if COMPILING_FOR_SHIPPED_SOURCE
namespace System.Web.UI.MobileControls.ShippedAdapterSource.XhtmlAdapters
#else
namespace System.Web.UI.MobileControls.Adapters.XhtmlAdapters
#endif
{
///
[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 XhtmlListAdapter : XhtmlControlAdapter {
///
protected new List Control {
get {
return base.Control as List;
}
}
///
public override void Render (XhtmlMobileTextWriter writer) {
if (Control.HasControls()) {
ConditionalRenderOpeningDivElement(writer);
RenderChildren (writer);
ConditionalRenderClosingDivElement(writer);
return;
}
if (Control.Items.Count != 0) {
ClearPendingBreakIfDeviceBreaksOnBlockLevel(writer); // we are writing a block level element in all cases.
}
ConditionalEnterLayout(writer, Style);
RenderList (writer);
ConditionalExitLayout(writer, Style);
}
///
protected virtual void RenderList (XhtmlMobileTextWriter writer) {
MobileListItemCollection items = Control.Items;
if (items.Count == 0) {
return;
}
ListDecoration decoration = Control.Decoration;
// Review: Consider replacing switch.
switch (decoration) {
case ListDecoration.Bulleted:
RenderBulletedList (writer);
break;
case ListDecoration.Numbered:
RenderNumberedList (writer);
break;
default:
if (!Device.Tables) {
RenderUndecoratedList(writer);
return;
}
RenderTableList (writer);
break;
}
}
private void RenderBulletedList (XhtmlMobileTextWriter writer) {
RenderOpeningListTag(writer, "ul");
RenderListBody (writer, "", " ");
RenderClosingListTag (writer, "ul");
}
private void RenderTableList (XhtmlMobileTextWriter writer) {
RenderOpeningListTag(writer, "table");
RenderListBody (writer, "", " ");
RenderClosingListTag(writer, "table");
}
private void RenderNumberedList (XhtmlMobileTextWriter writer) {
RenderOpeningListTag(writer, "ol");
RenderListBody (writer, "", " ");
RenderClosingListTag(writer, "ol");
}
private void RenderListBody (XhtmlMobileTextWriter writer, String itemPrefix, String itemSuffix) {
int pageStart = Control.FirstVisibleItemIndex;
int pageSize = Control.VisibleItemCount;
for (int i = 0; i < pageSize; i++) {
MobileListItem item = Control.Items[pageStart + i];
writer.Write (itemPrefix);
RenderListItem (writer, item);
writer.WriteLine(itemSuffix);
}
}
private void RenderUndecoratedList (XhtmlMobileTextWriter writer) {
String br = writer.UseDivsForBreaks ? "
"; if((string)Device["usePOverDiv"] == "true") br = "
"; RenderListBody (writer, "", br); } private void RenderListItem (XhtmlMobileTextWriter writer, MobileListItem item) { String accessKey = GetCustomAttributeValue(item, XhtmlConstants.AccessKeyCustomAttribute); String cssClass = GetCustomAttributeValue(item, XhtmlConstants.CssClassCustomAttribute); if (Control.ItemsAsLinks) { RenderBeginLink (writer, item.Value, accessKey, Style, cssClass); writer.WriteEncodedText (item.Text); RenderEndLink (writer); } else if (Control.HasItemCommandHandler) { RenderPostBackEventAsAnchor (writer, item.Index.ToString(CultureInfo.InvariantCulture) /*event argument*/, item.Text /*link text*/, accessKey, Style, cssClass); } else { writer.WriteEncodedText (item.Text); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //
" : "
"; if((string)Device["usePOverDiv"] == "true") br = "
"; RenderListBody (writer, "", br); } private void RenderListItem (XhtmlMobileTextWriter writer, MobileListItem item) { String accessKey = GetCustomAttributeValue(item, XhtmlConstants.AccessKeyCustomAttribute); String cssClass = GetCustomAttributeValue(item, XhtmlConstants.CssClassCustomAttribute); if (Control.ItemsAsLinks) { RenderBeginLink (writer, item.Value, accessKey, Style, cssClass); writer.WriteEncodedText (item.Text); RenderEndLink (writer); } else if (Control.HasItemCommandHandler) { RenderPostBackEventAsAnchor (writer, item.Index.ToString(CultureInfo.InvariantCulture) /*event argument*/, item.Text /*link text*/, accessKey, Style, cssClass); } else { writer.WriteEncodedText (item.Text); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
"; if((string)Device["usePOverDiv"] == "true") br = "
"; RenderListBody (writer, "", br); } private void RenderListItem (XhtmlMobileTextWriter writer, MobileListItem item) { String accessKey = GetCustomAttributeValue(item, XhtmlConstants.AccessKeyCustomAttribute); String cssClass = GetCustomAttributeValue(item, XhtmlConstants.CssClassCustomAttribute); if (Control.ItemsAsLinks) { RenderBeginLink (writer, item.Value, accessKey, Style, cssClass); writer.WriteEncodedText (item.Text); RenderEndLink (writer); } else if (Control.HasItemCommandHandler) { RenderPostBackEventAsAnchor (writer, item.Index.ToString(CultureInfo.InvariantCulture) /*event argument*/, item.Text /*link text*/, accessKey, Style, cssClass); } else { writer.WriteEncodedText (item.Text); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- AccessViolationException.cs
- RewritingSimplifier.cs
- CurrentChangingEventArgs.cs
- CompilerWrapper.cs
- TextSpan.cs
- _ShellExpression.cs
- XmlSchemaSequence.cs
- CreateParams.cs
- TemplatedWizardStep.cs
- SqlFactory.cs
- SoapAttributes.cs
- GZipObjectSerializer.cs
- AnimatedTypeHelpers.cs
- PrintPreviewGraphics.cs
- Menu.cs
- ExeConfigurationFileMap.cs
- Rfc4050KeyFormatter.cs
- ValueType.cs
- HttpListenerException.cs
- xmlsaver.cs
- ScrollableControl.cs
- ServiceDesigner.cs
- MouseBinding.cs
- ExtendedPropertyCollection.cs
- ThreadExceptionEvent.cs
- DataGridViewColumn.cs
- XPathNavigatorKeyComparer.cs
- ManagementException.cs
- CodeAssignStatement.cs
- ResourceDescriptionAttribute.cs
- ClientData.cs
- Transaction.cs
- SHA1Cng.cs
- ResourceAttributes.cs
- RenderData.cs
- ImpersonateTokenRef.cs
- ConnectionStringsSection.cs
- TCEAdapterGenerator.cs
- NotEqual.cs
- ArraySubsetEnumerator.cs
- ObjectStateEntryDbUpdatableDataRecord.cs
- DocumentCollection.cs
- SelectiveScrollingGrid.cs
- ItemCollection.cs
- WindowsListView.cs
- SchemaCollectionCompiler.cs
- VirtualizingStackPanel.cs
- EditorPart.cs
- Configuration.cs
- ClientSession.cs
- VisualProxy.cs
- RuleRefElement.cs
- Error.cs
- InkCanvasAutomationPeer.cs
- MediaPlayer.cs
- SessionStateItemCollection.cs
- AstTree.cs
- QueuePathEditor.cs
- DiscardableAttribute.cs
- httpserverutility.cs
- Function.cs
- PropertyStore.cs
- GACIdentityPermission.cs
- VideoDrawing.cs
- OracleTimeSpan.cs
- Clipboard.cs
- Splitter.cs
- LinkDescriptor.cs
- AssemblyCache.cs
- ChannelBinding.cs
- MainMenu.cs
- ClientCultureInfo.cs
- LocalIdKeyIdentifierClause.cs
- FixedDocument.cs
- InputManager.cs
- TextShapeableCharacters.cs
- ObjectCacheSettings.cs
- Vector3DKeyFrameCollection.cs
- ChangeTracker.cs
- ProcessThread.cs
- InputEventArgs.cs
- RsaElement.cs
- AdornerHitTestResult.cs
- ReturnEventArgs.cs
- OperandQuery.cs
- SecurityContext.cs
- Matrix3DConverter.cs
- BitmapEditor.cs
- LockRecursionException.cs
- COSERVERINFO.cs
- UnionCodeGroup.cs
- InternalTypeHelper.cs
- WebHttpBindingElement.cs
- Attributes.cs
- WorkflowFileItem.cs
- ObjectDataSourceDisposingEventArgs.cs
- GridLength.cs
- ProviderBase.cs
- SQLUtility.cs
- DiagnosticTraceSource.cs