Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / xsp / System / Web / UI / HTMLTagNameToTypeMapper.cs / 1 / HTMLTagNameToTypeMapper.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- /* * Mapper of html tags to control types. * * Copyright (c) 1998 Microsoft Corporation */ namespace System.Web.UI { using System.ComponentModel; using System; using System.Collections; using System.Collections.Specialized; using System.Reflection; using System.Web.UI.HtmlControls; using System.Web.Util; using System.Globalization; internal class HtmlTagNameToTypeMapper : ITagNameToTypeMapper { static Hashtable _tagMap; static Hashtable _inputTypes; internal HtmlTagNameToTypeMapper() { } /*public*/ Type ITagNameToTypeMapper.GetControlType(string tagName, IDictionary attributeBag) { Type controlType; if (_tagMap == null) { Hashtable t = new Hashtable(10, StringComparer.OrdinalIgnoreCase); t.Add("a", typeof(HtmlAnchor)); t.Add("button", typeof(HtmlButton)); t.Add("form", typeof(HtmlForm)); t.Add("head", typeof(HtmlHead)); t.Add("img", typeof(HtmlImage)); t.Add("textarea", typeof(HtmlTextArea)); t.Add("select", typeof(HtmlSelect)); t.Add("table", typeof(HtmlTable)); t.Add("tr", typeof(HtmlTableRow)); t.Add("td", typeof(HtmlTableCell)); t.Add("th", typeof(HtmlTableCell)); _tagMap = t; } if (_inputTypes == null) { Hashtable t = new Hashtable(10, StringComparer.OrdinalIgnoreCase); t.Add("text", typeof(HtmlInputText)); t.Add("password", typeof(HtmlInputPassword)); t.Add("button", typeof(HtmlInputButton)); t.Add("submit", typeof(HtmlInputSubmit)); t.Add("reset", typeof(HtmlInputReset)); t.Add("image", typeof(HtmlInputImage)); t.Add("checkbox", typeof(HtmlInputCheckBox)); t.Add("radio", typeof(HtmlInputRadioButton)); t.Add("hidden", typeof(HtmlInputHidden)); t.Add("file", typeof(HtmlInputFile)); _inputTypes = t; } if (StringUtil.EqualsIgnoreCase("input", tagName)) { string type = (string)attributeBag["type"]; if (type == null) type = "text"; controlType = (Type)_inputTypes[type]; if (controlType == null) throw new HttpException( SR.GetString(SR.Invalid_type_for_input_tag, type)); } else { controlType = (Type)_tagMap[tagName]; if (controlType == null) controlType = typeof(HtmlGenericControl); } return controlType; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- /* * Mapper of html tags to control types. * * Copyright (c) 1998 Microsoft Corporation */ namespace System.Web.UI { using System.ComponentModel; using System; using System.Collections; using System.Collections.Specialized; using System.Reflection; using System.Web.UI.HtmlControls; using System.Web.Util; using System.Globalization; internal class HtmlTagNameToTypeMapper : ITagNameToTypeMapper { static Hashtable _tagMap; static Hashtable _inputTypes; internal HtmlTagNameToTypeMapper() { } /*public*/ Type ITagNameToTypeMapper.GetControlType(string tagName, IDictionary attributeBag) { Type controlType; if (_tagMap == null) { Hashtable t = new Hashtable(10, StringComparer.OrdinalIgnoreCase); t.Add("a", typeof(HtmlAnchor)); t.Add("button", typeof(HtmlButton)); t.Add("form", typeof(HtmlForm)); t.Add("head", typeof(HtmlHead)); t.Add("img", typeof(HtmlImage)); t.Add("textarea", typeof(HtmlTextArea)); t.Add("select", typeof(HtmlSelect)); t.Add("table", typeof(HtmlTable)); t.Add("tr", typeof(HtmlTableRow)); t.Add("td", typeof(HtmlTableCell)); t.Add("th", typeof(HtmlTableCell)); _tagMap = t; } if (_inputTypes == null) { Hashtable t = new Hashtable(10, StringComparer.OrdinalIgnoreCase); t.Add("text", typeof(HtmlInputText)); t.Add("password", typeof(HtmlInputPassword)); t.Add("button", typeof(HtmlInputButton)); t.Add("submit", typeof(HtmlInputSubmit)); t.Add("reset", typeof(HtmlInputReset)); t.Add("image", typeof(HtmlInputImage)); t.Add("checkbox", typeof(HtmlInputCheckBox)); t.Add("radio", typeof(HtmlInputRadioButton)); t.Add("hidden", typeof(HtmlInputHidden)); t.Add("file", typeof(HtmlInputFile)); _inputTypes = t; } if (StringUtil.EqualsIgnoreCase("input", tagName)) { string type = (string)attributeBag["type"]; if (type == null) type = "text"; controlType = (Type)_inputTypes[type]; if (controlType == null) throw new HttpException( SR.GetString(SR.Invalid_type_for_input_tag, type)); } else { controlType = (Type)_tagMap[tagName]; if (controlType == null) controlType = typeof(HtmlGenericControl); } return controlType; } } } // 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
- SiteOfOriginContainer.cs
- SerialPinChanges.cs
- NativeMethodsCLR.cs
- PageParser.cs
- BasePropertyDescriptor.cs
- ObfuscationAttribute.cs
- WebRequestModulesSection.cs
- DetailsViewUpdateEventArgs.cs
- ReadOnlyCollectionBase.cs
- InternalTypeHelper.cs
- DeferredElementTreeState.cs
- FamilyCollection.cs
- DataGridViewImageColumn.cs
- ClientBuildManagerCallback.cs
- RequestCacheEntry.cs
- TextAnchor.cs
- GridViewColumnHeaderAutomationPeer.cs
- ImageBrush.cs
- SimpleTableProvider.cs
- DrawingState.cs
- ConstraintManager.cs
- TextParentUndoUnit.cs
- IndentedTextWriter.cs
- TextRangeEditLists.cs
- CheckBox.cs
- IsolatedStorageFilePermission.cs
- Base64Encoder.cs
- BulletedListEventArgs.cs
- XsltConvert.cs
- SqlProvider.cs
- MetadataWorkspace.cs
- EntityDataSourceContextCreatedEventArgs.cs
- TextDecorations.cs
- CompoundFileReference.cs
- StateItem.cs
- ResizeBehavior.cs
- ContentOnlyMessage.cs
- BackgroundWorker.cs
- DesignerActionService.cs
- CLRBindingWorker.cs
- _SafeNetHandles.cs
- HttpRequestBase.cs
- FilterableAttribute.cs
- MessageQueueException.cs
- FormViewActionList.cs
- AliasExpr.cs
- PackageDigitalSignatureManager.cs
- DbgCompiler.cs
- GridViewEditEventArgs.cs
- WindowInteropHelper.cs
- TTSEngineProxy.cs
- HtmlInputCheckBox.cs
- OleDbCommand.cs
- X509PeerCertificateAuthenticationElement.cs
- MemberProjectedSlot.cs
- ErrorProvider.cs
- DataGridSortCommandEventArgs.cs
- SecondaryIndexDefinition.cs
- DesignTimeVisibleAttribute.cs
- EditingCoordinator.cs
- AutoGeneratedField.cs
- SchemaImporter.cs
- BamlResourceSerializer.cs
- Tablet.cs
- XNodeNavigator.cs
- IISMapPath.cs
- BuildProvidersCompiler.cs
- MergeEnumerator.cs
- HtmlContainerControl.cs
- SamlAuthenticationStatement.cs
- ManipulationDelta.cs
- UrlMapping.cs
- FieldDescriptor.cs
- LinkLabel.cs
- FileLogRecord.cs
- XPathArrayIterator.cs
- MaterialGroup.cs
- CanExecuteRoutedEventArgs.cs
- SafeNativeMethods.cs
- ContentPlaceHolderDesigner.cs
- UIElementCollection.cs
- DrawingGroup.cs
- CodeCompiler.cs
- Header.cs
- StreamUpgradeAcceptor.cs
- XmlWellformedWriter.cs
- AllowedAudienceUriElementCollection.cs
- WindowsToolbarItemAsMenuItem.cs
- FrameworkElementAutomationPeer.cs
- DispatcherOperation.cs
- TypeListConverter.cs
- CorruptStoreException.cs
- EnvelopedPkcs7.cs
- ExtendedProtectionPolicyTypeConverter.cs
- ViewPort3D.cs
- HtmlInputImage.cs
- SolidColorBrush.cs
- TextEffect.cs
- CombinedGeometry.cs
- DecimalAnimation.cs