Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / 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
- WorkflowViewStateService.cs
- SafeFileMappingHandle.cs
- XPathSingletonIterator.cs
- CodeExpressionCollection.cs
- ExpressionBuilder.cs
- X509SecurityTokenAuthenticator.cs
- _NestedSingleAsyncResult.cs
- PaintEvent.cs
- TdsValueSetter.cs
- CurrencyManager.cs
- SchemaImporterExtensionElementCollection.cs
- Documentation.cs
- ThreadAbortException.cs
- InternalPermissions.cs
- metrodevice.cs
- XmlNodeChangedEventArgs.cs
- GridSplitter.cs
- ToolStripDropDownClosedEventArgs.cs
- DomainUpDown.cs
- MemberCollection.cs
- StringKeyFrameCollection.cs
- UserUseLicenseDictionaryLoader.cs
- RadioButtonList.cs
- EventHandlers.cs
- ElementHost.cs
- BitmapEffectvisualstate.cs
- TripleDESCryptoServiceProvider.cs
- HtmlInputControl.cs
- GridViewColumnCollectionChangedEventArgs.cs
- AuthenticationService.cs
- EntityException.cs
- XmlILAnnotation.cs
- TraceContext.cs
- AnimationClockResource.cs
- DateTimePickerDesigner.cs
- ClientFormsAuthenticationMembershipProvider.cs
- TextViewBase.cs
- AppDomainManager.cs
- selecteditemcollection.cs
- ParsedAttributeCollection.cs
- InternalControlCollection.cs
- NavigationPropertyAccessor.cs
- HandledMouseEvent.cs
- BindingBase.cs
- WindowsGraphicsWrapper.cs
- LogExtent.cs
- IgnoreFlushAndCloseStream.cs
- UnaryExpressionHelper.cs
- RelatedImageListAttribute.cs
- EllipseGeometry.cs
- TypeHelper.cs
- GenerateScriptTypeAttribute.cs
- Rotation3DKeyFrameCollection.cs
- ArraySortHelper.cs
- NavigationPropertyEmitter.cs
- CdpEqualityComparer.cs
- ConfigurationSectionHelper.cs
- SQLStringStorage.cs
- SecurityBindingElement.cs
- VerificationException.cs
- Popup.cs
- HttpHandlersSection.cs
- ProviderCommandInfoUtils.cs
- BufferedGraphics.cs
- EventLogEntryCollection.cs
- COM2TypeInfoProcessor.cs
- DockProviderWrapper.cs
- EncryptedPackage.cs
- SecurityUtils.cs
- Brush.cs
- _NetworkingPerfCounters.cs
- ViewSimplifier.cs
- List.cs
- XmlSchemaSequence.cs
- ListViewInsertedEventArgs.cs
- XmlResolver.cs
- ReadOnlyState.cs
- OrderPreservingPipeliningSpoolingTask.cs
- BlockUIContainer.cs
- ApplicationServiceManager.cs
- DBAsyncResult.cs
- SystemWebExtensionsSectionGroup.cs
- FocusWithinProperty.cs
- LinqDataSourceDeleteEventArgs.cs
- ModuleBuilderData.cs
- CreationContext.cs
- TableAdapterManagerHelper.cs
- SpecialNameAttribute.cs
- ClaimTypeElementCollection.cs
- DirtyTextRange.cs
- AttributeTableBuilder.cs
- ToolTip.cs
- FrameworkElementAutomationPeer.cs
- SizeF.cs
- Listbox.cs
- UniqueIdentifierService.cs
- XmlByteStreamReader.cs
- Transform3DGroup.cs
- FontWeight.cs
- SelectionEditingBehavior.cs