Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / ndp / fx / src / xsp / System / Web / Extensions / ui / ControlUtil.cs / 1 / ControlUtil.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- using System; using System.Collections.Generic; using System.Text; using System.Web.Resources; using System.Web.UI; namespace System.Web.UI { internal class ControlUtil { internal static Control FindTargetControl(string controlID, Control control, bool searchNamingContainers) { Control foundControl; if (searchNamingContainers) { Control currentContainer; foundControl = null; // DevDiv 73305: Do not assume starting control is not a naming container. if (control is INamingContainer) { currentContainer = control; } else { currentContainer = control.NamingContainer; } do { foundControl = currentContainer.FindControl(controlID); currentContainer = currentContainer.NamingContainer; } while (foundControl == null && currentContainer != null); } else { foundControl = control.FindControl(controlID); } return foundControl; } internal static bool IsBuiltInHiddenField(string hiddenFieldName) { // Returns true is the field name represents a hidden field generated // by ASP.NET's core runtime. This includes fields such as ViewState and // EventValidation, but not ones generated by specific controls such as // TreeView and WebParts. // If the field is less than two chars long it's not built-in. (Perf) if (hiddenFieldName.Length <= 2) { return false; } // If it doesn't start with two underscores, it's not built-in. (Perf) if (hiddenFieldName[0] != '_' || hiddenFieldName[1] != '_') { return false; } // Examine list of built-in ASP.NET fields. The list was created by examining // the ASP.NET source code for hidden field registration and rendering. // We exclude __VIEWSTATEENCRYPTED and __VIEWSTATEFIELDCOUNT from the list // since they're covered by the general __VIEWSTATE part. return hiddenFieldName.StartsWith("__VIEWSTATE", StringComparison.Ordinal) || String.Equals(hiddenFieldName, "__EVENTVALIDATION", StringComparison.Ordinal) || String.Equals(hiddenFieldName, "__LASTFOCUS", StringComparison.Ordinal) || String.Equals(hiddenFieldName, "__SCROLLPOSITIONX", StringComparison.Ordinal) || String.Equals(hiddenFieldName, "__SCROLLPOSITIONY", StringComparison.Ordinal) || String.Equals(hiddenFieldName, "__EVENTTARGET", StringComparison.Ordinal) || String.Equals(hiddenFieldName, "__EVENTARGUMENT", StringComparison.Ordinal) || String.Equals(hiddenFieldName, "__PREVIOUSPAGE", StringComparison.Ordinal); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- using System; using System.Collections.Generic; using System.Text; using System.Web.Resources; using System.Web.UI; namespace System.Web.UI { internal class ControlUtil { internal static Control FindTargetControl(string controlID, Control control, bool searchNamingContainers) { Control foundControl; if (searchNamingContainers) { Control currentContainer; foundControl = null; // DevDiv 73305: Do not assume starting control is not a naming container. if (control is INamingContainer) { currentContainer = control; } else { currentContainer = control.NamingContainer; } do { foundControl = currentContainer.FindControl(controlID); currentContainer = currentContainer.NamingContainer; } while (foundControl == null && currentContainer != null); } else { foundControl = control.FindControl(controlID); } return foundControl; } internal static bool IsBuiltInHiddenField(string hiddenFieldName) { // Returns true is the field name represents a hidden field generated // by ASP.NET's core runtime. This includes fields such as ViewState and // EventValidation, but not ones generated by specific controls such as // TreeView and WebParts. // If the field is less than two chars long it's not built-in. (Perf) if (hiddenFieldName.Length <= 2) { return false; } // If it doesn't start with two underscores, it's not built-in. (Perf) if (hiddenFieldName[0] != '_' || hiddenFieldName[1] != '_') { return false; } // Examine list of built-in ASP.NET fields. The list was created by examining // the ASP.NET source code for hidden field registration and rendering. // We exclude __VIEWSTATEENCRYPTED and __VIEWSTATEFIELDCOUNT from the list // since they're covered by the general __VIEWSTATE part. return hiddenFieldName.StartsWith("__VIEWSTATE", StringComparison.Ordinal) || String.Equals(hiddenFieldName, "__EVENTVALIDATION", StringComparison.Ordinal) || String.Equals(hiddenFieldName, "__LASTFOCUS", StringComparison.Ordinal) || String.Equals(hiddenFieldName, "__SCROLLPOSITIONX", StringComparison.Ordinal) || String.Equals(hiddenFieldName, "__SCROLLPOSITIONY", StringComparison.Ordinal) || String.Equals(hiddenFieldName, "__EVENTTARGET", StringComparison.Ordinal) || String.Equals(hiddenFieldName, "__EVENTARGUMENT", StringComparison.Ordinal) || String.Equals(hiddenFieldName, "__PREVIOUSPAGE", StringComparison.Ordinal); } } } // 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
- Pkcs7Recipient.cs
- DeclarativeCatalogPart.cs
- ObjectStateFormatter.cs
- ELinqQueryState.cs
- DecimalAnimation.cs
- RecognizedWordUnit.cs
- XmlChildEnumerator.cs
- SqlCachedBuffer.cs
- PropertyReferenceSerializer.cs
- TrustManagerMoreInformation.cs
- SignatureHelper.cs
- PathNode.cs
- RtfToXamlReader.cs
- XamlReaderConstants.cs
- SpellerInterop.cs
- QueryValue.cs
- Int32Rect.cs
- PropertyItemInternal.cs
- NullableIntSumAggregationOperator.cs
- MenuItemAutomationPeer.cs
- WinFormsComponentEditor.cs
- URI.cs
- ManagementBaseObject.cs
- TargetConverter.cs
- SystemDropShadowChrome.cs
- SchemaCollectionPreprocessor.cs
- DataGridTableCollection.cs
- Pair.cs
- TextCompositionEventArgs.cs
- GZipUtils.cs
- MediaElementAutomationPeer.cs
- RoutedEventConverter.cs
- PathFigureCollectionConverter.cs
- EDesignUtil.cs
- Zone.cs
- TransformGroup.cs
- EndpointDispatcherTable.cs
- CodeIdentifiers.cs
- ApplicationFileCodeDomTreeGenerator.cs
- Control.cs
- WebPartConnectionsCloseVerb.cs
- ProcessHostConfigUtils.cs
- AutomationElementCollection.cs
- DataGridViewLinkColumn.cs
- XmlAtomicValue.cs
- FunctionUpdateCommand.cs
- DesignUtil.cs
- X500Name.cs
- FilterableAttribute.cs
- ThemeDirectoryCompiler.cs
- StateItem.cs
- _Rfc2616CacheValidators.cs
- StringAttributeCollection.cs
- WindowsAuthenticationEventArgs.cs
- ObjectIDGenerator.cs
- RouteValueDictionary.cs
- BookmarkResumptionRecord.cs
- CounterCreationDataCollection.cs
- TableLayoutStyleCollection.cs
- KeySplineConverter.cs
- ParsedAttributeCollection.cs
- XmlUtil.cs
- XmlSerializerFactory.cs
- JpegBitmapDecoder.cs
- OleDbReferenceCollection.cs
- CachedTypeface.cs
- SectionRecord.cs
- StaticResourceExtension.cs
- MarkupProperty.cs
- JavaScriptObjectDeserializer.cs
- SingleBodyParameterMessageFormatter.cs
- XmlILTrace.cs
- RegionIterator.cs
- Vector.cs
- Model3DGroup.cs
- PageParserFilter.cs
- RequestQueue.cs
- FamilyTypeface.cs
- TransportChannelFactory.cs
- WebServiceTypeData.cs
- XsltSettings.cs
- PasswordTextContainer.cs
- XsdDataContractImporter.cs
- LocalizationParserHooks.cs
- CompilerErrorCollection.cs
- ToolStripContainer.cs
- PasswordRecoveryAutoFormat.cs
- InlineObject.cs
- UInt64Converter.cs
- ArrayConverter.cs
- CircleHotSpot.cs
- StateDesigner.Helpers.cs
- ToolStripDropDownItemDesigner.cs
- XsdCachingReader.cs
- M3DUtil.cs
- HtmlLink.cs
- RouteParameter.cs
- SqlMethodAttribute.cs
- CreateSequence.cs
- TextLineBreak.cs