Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / MIT / System / Web / UI / MobileControls / Adapters / XhtmlAdapters / XhtmlBasicTextBoxAdapter.cs / 1305376 / XhtmlBasicTextBoxAdapter.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- using System; using System.Security.Permissions; using System.Web.UI; using System.Web.Mobile; using System.Web.UI.MobileControls; using System.Web.UI.MobileControls.Adapters; using System.Globalization; #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 XhtmlTextBoxAdapter : XhtmlControlAdapter { /// public new TextBox Control { get { return base.Control as TextBox; } } // Used for optimization in RenderAsHiddenField. private String _staticValue; /// public override void OnInit(EventArgs e) { _staticValue = Control.Text; base.OnInit(e); } /// public override void Render(XhtmlMobileTextWriter writer) { ConditionalClearPendingBreak(writer); ConditionalEnterStyle(writer, Style); ConditionalRenderOpeningSpanElement(writer); if ((String) Device[XhtmlConstants.RequiresOnEnterForward] == "true") { writer.AddOnEnterForwardSetVar(Control.UniqueID, Control.Text); } writer.WriteBeginTag("input"); writer.WriteAttribute("name", Control.UniqueID); ConditionalRenderCustomAttribute(writer, XhtmlConstants.AccessKeyCustomAttribute); String controlText = Control.Text; if (controlText != null && controlText.Length > 0 && !Control.Password) { writer.Write(" value=\""); writer.WriteEncodedText(controlText); writer.Write("\""); } if (Control.Size > 0) { writer.WriteAttribute("size", Control.Size.ToString(CultureInfo.InvariantCulture)); } if (Control.MaxLength > 0) { writer.WriteAttribute("maxlength", Control.MaxLength.ToString(CultureInfo.InvariantCulture)); } String requiresType = Device["requiresInputTypeAttribute"]; if (Control.Password) { writer.WriteAttribute("type", "password"); } // InvariantCulture not needed, but included for best practices. else if (requiresType != null && String.Equals(requiresType, "true", StringComparison.OrdinalIgnoreCase)) { writer.WriteAttribute("type", "text"); } writer.Write("/>"); // ConditionalSetPendingBreak should always be called *before* ConditionalExitStyle. // ConditionalExitStyle may render a block element and clear the pending break. ConditionalSetPendingBreakAfterInline(writer); ConditionalRenderClosingSpanElement(writer); ConditionalExitStyle(writer, Style); } /// protected override void RenderAsHiddenInputField(XhtmlMobileTextWriter writer) { // Optimization - if viewstate is enabled for this control, and the // postback returns to this page, we just let it do the trick. if (Control.Form.Action.Length > 0 || (!IsViewStateEnabled() && Control.Text != _staticValue)) { writer.WriteHiddenField(Control.UniqueID, Control.Text); } } private bool IsViewStateEnabled() { Control ctl = Control; while (ctl != null) { if (!ctl.EnableViewState) { return false; } ctl = ctl.Parent; } return true; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ // // Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- using System; using System.Security.Permissions; using System.Web.UI; using System.Web.Mobile; using System.Web.UI.MobileControls; using System.Web.UI.MobileControls.Adapters; using System.Globalization; #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 XhtmlTextBoxAdapter : XhtmlControlAdapter { /// public new TextBox Control { get { return base.Control as TextBox; } } // Used for optimization in RenderAsHiddenField. private String _staticValue; /// public override void OnInit(EventArgs e) { _staticValue = Control.Text; base.OnInit(e); } /// public override void Render(XhtmlMobileTextWriter writer) { ConditionalClearPendingBreak(writer); ConditionalEnterStyle(writer, Style); ConditionalRenderOpeningSpanElement(writer); if ((String) Device[XhtmlConstants.RequiresOnEnterForward] == "true") { writer.AddOnEnterForwardSetVar(Control.UniqueID, Control.Text); } writer.WriteBeginTag("input"); writer.WriteAttribute("name", Control.UniqueID); ConditionalRenderCustomAttribute(writer, XhtmlConstants.AccessKeyCustomAttribute); String controlText = Control.Text; if (controlText != null && controlText.Length > 0 && !Control.Password) { writer.Write(" value=\""); writer.WriteEncodedText(controlText); writer.Write("\""); } if (Control.Size > 0) { writer.WriteAttribute("size", Control.Size.ToString(CultureInfo.InvariantCulture)); } if (Control.MaxLength > 0) { writer.WriteAttribute("maxlength", Control.MaxLength.ToString(CultureInfo.InvariantCulture)); } String requiresType = Device["requiresInputTypeAttribute"]; if (Control.Password) { writer.WriteAttribute("type", "password"); } // InvariantCulture not needed, but included for best practices. else if (requiresType != null && String.Equals(requiresType, "true", StringComparison.OrdinalIgnoreCase)) { writer.WriteAttribute("type", "text"); } writer.Write("/>"); // ConditionalSetPendingBreak should always be called *before* ConditionalExitStyle. // ConditionalExitStyle may render a block element and clear the pending break. ConditionalSetPendingBreakAfterInline(writer); ConditionalRenderClosingSpanElement(writer); ConditionalExitStyle(writer, Style); } /// protected override void RenderAsHiddenInputField(XhtmlMobileTextWriter writer) { // Optimization - if viewstate is enabled for this control, and the // postback returns to this page, we just let it do the trick. if (Control.Form.Action.Length > 0 || (!IsViewStateEnabled() && Control.Text != _staticValue)) { writer.WriteHiddenField(Control.UniqueID, Control.Text); } } private bool IsViewStateEnabled() { Control ctl = Control; while (ctl != null) { if (!ctl.EnableViewState) { return false; } ctl = ctl.Parent; } return true; } } } // 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
- XmlAggregates.cs
- CodeStatementCollection.cs
- SqlInternalConnection.cs
- EventLogPermissionEntry.cs
- PagesChangedEventArgs.cs
- SqlCaseSimplifier.cs
- EncryptedType.cs
- XmlNamedNodeMap.cs
- SweepDirectionValidation.cs
- InvocationExpression.cs
- GAC.cs
- CachedTypeface.cs
- CategoryGridEntry.cs
- SystemIPInterfaceStatistics.cs
- LocalFileSettingsProvider.cs
- ConfigurationSettings.cs
- IListConverters.cs
- DBConnection.cs
- XMLSyntaxException.cs
- HtmlInputControl.cs
- GetWinFXPath.cs
- ToolStripButton.cs
- _ProxyRegBlob.cs
- TraceEventCache.cs
- FrugalList.cs
- FigureParagraph.cs
- COM2PropertyPageUITypeConverter.cs
- DataSourceControlBuilder.cs
- AutomationProperty.cs
- TrackBarRenderer.cs
- PermissionListSet.cs
- CompensationToken.cs
- ExtendedProtectionPolicyTypeConverter.cs
- PointLight.cs
- HelpProvider.cs
- PriorityBinding.cs
- SafeLibraryHandle.cs
- ParsedAttributeCollection.cs
- MetafileHeader.cs
- StrongNameKeyPair.cs
- XmlSerializerObjectSerializer.cs
- FrameworkTextComposition.cs
- ConnectionManager.cs
- WizardStepBase.cs
- WebPartConnectVerb.cs
- PersistenceProviderElement.cs
- EllipticalNodeOperations.cs
- XmlReflectionImporter.cs
- ToolStripSeparator.cs
- DeferredElementTreeState.cs
- Module.cs
- NativeMethods.cs
- ProviderUtil.cs
- URLAttribute.cs
- TextSelection.cs
- _LoggingObject.cs
- GlyphRun.cs
- KeyEvent.cs
- RowSpanVector.cs
- XmlTextReader.cs
- EventWaitHandle.cs
- FormsAuthenticationCredentials.cs
- SrgsSubset.cs
- SimpleBitVector32.cs
- PropertyMappingExceptionEventArgs.cs
- LineInfo.cs
- ToolStripPanelCell.cs
- DocumentCollection.cs
- CodeNamespaceImportCollection.cs
- DropDownList.cs
- Rectangle.cs
- TerminateSequenceResponse.cs
- SecurityChannelFaultConverter.cs
- TabControlAutomationPeer.cs
- ClientSettingsStore.cs
- XmlSchemaInferenceException.cs
- TemplateBindingExpression.cs
- MethodBuilderInstantiation.cs
- ISO2022Encoding.cs
- ObjectDataSourceFilteringEventArgs.cs
- XamlTemplateSerializer.cs
- XmlSchemaAll.cs
- TransactionFlowBindingElementImporter.cs
- Listener.cs
- Annotation.cs
- HScrollBar.cs
- ActivityInterfaces.cs
- Preprocessor.cs
- TypeConverterAttribute.cs
- XmlSchemaCollection.cs
- ObjectDataSourceDisposingEventArgs.cs
- Win32PrintDialog.cs
- OuterGlowBitmapEffect.cs
- WhereQueryOperator.cs
- MimeWriter.cs
- CanonicalXml.cs
- TemplateBaseAction.cs
- MetricEntry.cs
- TextTreeInsertUndoUnit.cs
- DataGridParentRows.cs