Example #1
0
// <snippet1>
        // Override the RenderBeginTag method to check whether
        // the tagKey parameter is set to a <label> element
        // or a <font> element.
        public override void RenderBeginTag(HtmlTextWriterTag tagKey)
        {
// <snippet2>
            // If the tagKey parameter is set to a <label> element
            // but a color attribute is not defined on the element,
            // the AddStyleAttribute method adds a color attribute
            // and sets it to red.
            if (tagKey == HtmlTextWriterTag.Label)
            {
                if (!IsStyleAttributeDefined(HtmlTextWriterStyle.Color))
                {
                    AddStyleAttribute(GetStyleKey("color"), "red");
                }
            }
// </snippet2>
// <snippet3>
            // If the tagKey parameter is set to a <font> element
            // but a size attribute is not defined on the element,
            // the AddStyleAttribute method adds a size attribute
            // and sets it to 30 point.
            if (tagKey == HtmlTextWriterTag.Font)
            {
                if (!IsAttributeDefined(HtmlTextWriterAttribute.Size))
                {
                    AddAttribute(GetAttributeKey("size"), "30pt");
                }
            }
// </snippet3>
            // Call the base class's RenderBeginTag method
            // to ensure that this custom MarkupTextWriter
            // includes functionality for all other markup elements.
            base.RenderBeginTag(tagKey);
        }
        internal static string BuildOneTag(string virtualPath, HtmlTextWriterTag tag)
        {
            TagRenderMode tagRenderMode;

            var tagBuilder = new TagBuilder(tag.ToString().ToLower());

            var absolutePath = VirtualPathUtility.ToAbsolute(virtualPath);
            switch (tag)
            {
                case HtmlTextWriterTag.Script:
                    tagRenderMode = TagRenderMode.Normal;
                    tagBuilder.MergeAttribute("type", "text/javascript");
                    tagBuilder.MergeAttribute("src", absolutePath);
                    break;
                case HtmlTextWriterTag.Link:
                    tagRenderMode = TagRenderMode.SelfClosing;
                    tagBuilder.MergeAttribute("type", "text/css");
                    tagBuilder.MergeAttribute("media", "all"); //always ALL?
                    tagBuilder.MergeAttribute("rel", "stylesheet");
                    tagBuilder.MergeAttribute("href", absolutePath);
                    break;
                default:
                    throw new InvalidOperationException();
            }

            return tagBuilder.ToString(tagRenderMode);
        }
Example #3
0
 private void WriteTag(HtmlTextWriter writer, HtmlTextWriterTag tag, string className, Action contentRenderer)
 {
     writer.AddAttribute(HtmlTextWriterAttribute.Class, className);
     writer.RenderBeginTag(tag);
     contentRenderer();
     writer.RenderEndTag();
 }
 public static HtmlTextWriter Full(this HtmlTextWriter writer, HtmlTextWriterTag tag, string content = "")
 {
     writer.RenderBeginTag(tag);
     writer.Write(content);
     writer.RenderEndTag();
     return writer;
 }
 public static void AddTag(this HtmlTextWriter writer, HtmlTextWriterTag tag,
                           string value = "")
 {
     writer.RenderBeginTag(tag);
     writer.Write(value != "" ? value : Environment.NewLine);
     writer.RenderEndTag();
 }
Example #6
0
        void DoBeginTag()
        {
            WriteIfNotNull(RenderBeforeTag());
            if (!TagIgnore)
            {
                WriteBeginTag(TagName);
                FilterAttributes();

                HtmlTextWriterTag key = (int)TagKey < tags.Length ? TagKey : HtmlTextWriterTag.Unknown;

                switch (tags [(int)key].tag_type)
                {
                case TagType.Inline:
                    Write(TagRightChar);
                    break;

                case TagType.Block:
                    Write(TagRightChar);
                    WriteLine();
                    Indent++;
                    break;

                case TagType.SelfClosing:
                    Write(SelfClosingTagEnd);
                    break;
                }
            }

            // FIXME what do i do for self close here?
            WriteIfNotNull(RenderBeforeContent());
        }
        public void EnsureEnumerations()
        {
            WriteDictionaryEntries <HtmlTextWriterTag>();
            WriteDictionaryEntries <HtmlTextWriterAttribute>();

            using MemoryStream mem      = new MemoryStream();
            using StreamWriter sw       = new StreamWriter(mem);
            using HtmlTextWriter writer = new HtmlTextWriter(sw);

            foreach (FieldInfo tagInfo in typeof(HtmlTextWriterTag).GetFields(BindingFlags.Public | BindingFlags.Static))
            {
                HtmlTextWriterTag tag = (HtmlTextWriterTag)tagInfo.GetRawConstantValue();
                if (tag == HtmlTextWriterTag.Unknown)
                {
                    continue;
                }

                writer.RenderBeginTag(tag);

                foreach (FieldInfo attrInfo in typeof(HtmlTextWriterAttribute).GetFields(BindingFlags.Public | BindingFlags.Static))
                {
                    HtmlTextWriterAttribute attr = (HtmlTextWriterAttribute)attrInfo.GetRawConstantValue();
                    writer.AddAttribute(attr, "1");
                }

                writer.RenderEndTag();
            }
Example #8
0
        public virtual void RenderEndTag()
        {
            // FIXME what do i do for self close here?
            WriteIfNotNull(RenderAfterContent());

            if (!TagIgnore)
            {
                HtmlTextWriterTag key = (int)TagKey < tags.Length ? TagKey : HtmlTextWriterTag.Unknown;

                switch (tags [(int)key].tag_type)
                {
                case TagType.Inline:
                    WriteEndTag(TagName);
                    break;

                case TagType.Block:
                    Indent--;
                    WriteLineNoTabs(String.Empty);
                    WriteEndTag(TagName);

                    break;

                case TagType.SelfClosing:
                    // NADA
                    break;
                }
            }

            WriteIfNotNull(RenderAfterTag());

            PopEndTag();
        }
        private MvcTag TagHelper(HtmlTextWriterTag htmlTag, string name, string errorClass = "invalid", IDictionary <string, object> htmlAttributes = null)
        {
            // tag
            MvcTag tag = new MvcTag(ViewContext, htmlTag);

            // attributes
            if (htmlAttributes != null)
            {
                tag.Builder.MergeAttributes(htmlAttributes);
            }

            // add the name if a form element
            if (new HtmlTextWriterTag[3] {
                HtmlTextWriterTag.Textarea, HtmlTextWriterTag.Input, HtmlTextWriterTag.Select
            }.Contains(htmlTag))
            {
                tag.Builder.Attributes.Add("name", name);
            }

            // model state error check
            if (!string.IsNullOrEmpty(errorClass))
            {
                ModelState state = GetState(ViewContext, name);
                if (state != null && state.Errors.Count > 0)
                {
                    tag.Builder.AddCssClass("invalid");
                }
            }

            // output to writer
            ViewContext.Writer.Write(tag.Builder.ToString(TagRenderMode.StartTag));

            // return tag
            return(tag);
        }
Example #10
0
 /// <summary>
 /// Writes an HTML tag
 /// </summary>
 /// <param name="tagKey">Type of tag to write</param>
 /// <returns><see cref="FluentHtmlTextWriter"/></returns>
 public FluentHtmlTextWriter WriteTag(HtmlTextWriterTag tagKey)
 {
     FlushActions();
     BeginTag(tagKey);
     SetEnd(f => f.RenderEndTag());
     return(this);
 }
Example #11
0
 public static void AppendText(this HtmlTextWriter htmlWriter,
                               string contents, HtmlTextWriterTag tag)
 {
     htmlWriter.RenderBeginTag(tag);
     htmlWriter.Write(contents);
     htmlWriter.RenderEndTag();
 }
Example #12
0
        /// <internalonly/>
        public override void RenderBeginTag(HtmlTextWriter writer)
        {
            AddAttributesToRender(writer);

            HtmlTextWriterTag tagKey = TagKey;

            if (tagKey != HtmlTextWriterTag.Unknown)
            {
                writer.RenderBeginTag(tagKey);
            }
            else
            {
                writer.RenderBeginTag(TagName);
            }

            string s           = GroupingText;
            bool   useGrouping = (s.Length != 0) && !(writer is Html32TextWriter);

            if (useGrouping)
            {
                writer.RenderBeginTag(HtmlTextWriterTag.Fieldset);
                _renderedFieldSet = true;
                writer.RenderBeginTag(HtmlTextWriterTag.Legend);
                writer.Write(s);
                writer.RenderEndTag();
            }
        }
Example #13
0
        public static string HtmlTag(
            this HtmlHelper htmlHelper,
            HtmlTextWriterTag tag,
            object htmlAttributes,
            Func <HtmlHelper, string> action)
        {
            var attributes = new RouteValueDictionary(htmlAttributes);

            using (var sw = new StringWriter())
            {
                using (var htmlWriter = new HtmlTextWriter(sw))
                {
                    // Add attributes
                    foreach (var attribute in attributes)
                    {
                        htmlWriter.AddAttribute(attribute.Key, attribute.Value != null ?
                                                attribute.Value.ToString() : string.Empty);
                    }

                    htmlWriter.RenderBeginTag(tag);
                    htmlWriter.Write(action.Invoke(htmlHelper));
                    htmlWriter.RenderEndTag();
                }

                return(sw.ToString());
            }
        }
        public static IDisposable RenderTag([NotNull] this HtmlTextWriter writer, HtmlTextWriterTag tag)
        {
            if (writer == null) throw new ArgumentNullException("writer");

            writer.RenderBeginTag(tag);
            return new DisposableAction(writer.RenderEndTag);
        }
 public static void AddTag(this HtmlTextWriter writer, HtmlTextWriterTag tag,
     string value = "")
 {
     writer.RenderBeginTag(tag);
     writer.Write(value != "" ? value : Environment.NewLine);
     writer.RenderEndTag();
 }
        /// <devdoc>
        /// <para>[To be supplied.]</para>
        /// </devdoc>
        public override void EnterStyle(Style style, HtmlTextWriterTag tag)
        {
            // Ignore tag for wml.
            if (AnalyzeMode)
            {
                return;
            }

            // All "block level controls" (controls that render using block level elements in HTML) call enterStyle
            // using a div.  Here we ensure that a new p is open for these controls to ensure line breaking behavior.
            if (tag == HtmlTextWriterTag.Div)
            {
                BeginBlockLevelControl();
            }

            Style stackStyle = new Style();

            stackStyle.CopyFrom(style);
            stackStyle.MergeWith(CurrentStyle);
            if (_panelStyleStack.Count > 0)
            {
                stackStyle.MergeWith((Style)_panelStyleStack.Peek());
            }
            _styleStack.Push(stackStyle); // updates CurrentStyle

            if (_paragraphOpen)
            {
                OpenCurrentStyleTags();
            }
        }
 public void RenderTag(HtmlTextWriterTag tagKey, string html)
 {
     RenderBeginTag(tagKey);
     if (!string.IsNullOrEmpty(html))
         Write(html);
     RenderEndTag();
 }
Example #18
0
 // Methods
 public void WriteHeading(HtmlTextWriterTag tag, string text)
 {
     RenderBeginTag(tag);
     WriteLine(text);
     RenderEndTag();
     WriteLine();
     WriteLine();
 }
Example #19
0
        public void RenderBeginTag(HtmlTextWriterTag tag)
        {
            string tagName = GetTagName(tag);

            writer.Write("<" + tagName + attrs + ">");
            tags.Push(tagName);
            attrs = "";
        }
Example #20
0
 /// <include file='doc\Html32TextWriter.uex' path='docs/doc[@for="Html32TextWriter.GetTagName"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 protected override string GetTagName(HtmlTextWriterTag tagKey)
 {
     if (tagKey == HtmlTextWriterTag.Div)
     {
         return("table");
     }
     return(base.GetTagName(tagKey));
 }
		/// <summary>
		/// Initializes a new instance of the HtmlTag class. Renders the opening tag of an HTML node, including any attributes.
		/// </summary>
		/// <param name="writer">
		/// The HTMLTextWriter.
		/// </param>
		/// <param name="tag">
		/// The type of HTML tag.
		/// </param>
		/// <param name="style">
		/// The style.
		/// </param>
		/// <param name="attributes">
		/// HTML attributes.
		/// </param>
		public HtmlTag(HtmlTextWriter writer, HtmlTextWriterTag tag, TagStyle style, params HtmlAttribute[] attributes)
		{
			this.writer = writer;
			this.attributes = attributes;
			this.tag = tag.ToString().ToLower();
			this.tagStyle = style;
			this.StartRender();
		}
Example #22
0
        public virtual void RenderBeginTag(HtmlTextWriterTag tagKey)
        {
            bool ignore = !OnTagRender(GetTagName(tagKey), tagKey);

            PushEndTag(tagKey);
            DoBeginTag();
            TagIgnore = ignore;
        }
Example #23
0
 protected override string GetTagName(HtmlTextWriterTag tagKey)
 {
     if ((tagKey == HtmlTextWriterTag.Div) && this.ShouldPerformDivTableSubstitution)
     {
         return("table");
     }
     return(base.GetTagName(tagKey));
 }
Example #24
0
        protected virtual string GetTagName(HtmlTextWriterTag tagKey)
        {
            if ((int)tagKey < tags.Length)
            {
                return(tags [(int)tagKey].name);
            }

            return(null);
        }
Example #25
0
        internal static string StaticGetTagName(HtmlTextWriterTag tagKey)
        {
            if ((int)tagKey < tags.Length)
            {
                return(tags [(int)tagKey].name);
            }

            return(null);
        }
Example #26
0
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 protected override string GetTagName(HtmlTextWriterTag tagKey)
 {
     // div->table substitution.
     if (tagKey == HtmlTextWriterTag.Div && ShouldPerformDivTableSubstitution)
     {
         return("table");
     }
     return(base.GetTagName(tagKey));
 }
 /// <summary>
 /// Writes a full (i.e. self-closed) HTML tag.
 /// </summary>
 ///
 /// <param name="hwTag">The name of the tag to write.</param>
 ///
 /// <param name="newLines">How many newlines to write after the end tag.</param>
 ///
 /// <param name="htmlTextWriter">The <c>HtmlTextWriter</c> to write to.</param>
 ///
 public static void WriteFullTag(HtmlTextWriterTag hwTag, int newLines, HtmlTextWriter htmlTextWriter)
 {
     htmlTextWriter.RenderBeginTag(hwTag);
     htmlTextWriter.RenderEndTag();
     for (int i = 0; i < newLines; i++)
     {
         htmlTextWriter.WriteLine();
     }
 }
Example #28
0
 public void RenderTag(HtmlTextWriterTag tagKey, string html)
 {
     RenderBeginTag(tagKey);
     if (!string.IsNullOrEmpty(html))
     {
         Write(html);
     }
     RenderEndTag();
 }
Example #29
0
 internal static void RenderElement(this HtmlTextWriter writer, HtmlTextWriterTag tag, string format, params object[] arg)
 {
     writer.RenderBeginTag(tag);
     if (format != null)
     {
         writer.Write(format, arg);
     }
     writer.RenderEndTag();
 }
Example #30
0
 protected BaseSecuredControl(HtmlTextWriterTag Tag, HtmlInputType InputType)
     : base(Tag)
 {
     m_Text                   = "";
     m_Description            = "";
     m_SecurityContext        = "";
     m_bCausesValidation      = false;
     m_bRequiresAuthorization = false;
     m_bDoPostBack            = false;
 }
Example #31
0
        private String GetTagName(HtmlTextWriterTag key)
        {
            String name = key.ToString().ToLower();

            if (name.Contains("."))
            {
                name = name.Substring(name.LastIndexOf(".") + 1);
            }
            return(name);
        }
Example #32
0
        private static IHtmlNode GetNumericTagWithOptionalClass(HtmlTextWriterTag tag, string className, int value)
        {
            var node = Html.Tag(tag).Content(value.ToString());

            if (value != 0)
            {
                node.Class(className);
            }
            return(node);
        }
        public override void RenderBeginTag(HtmlTextWriterTag tagKey)
        {
            output.WriteLine("{0:###0} RenderBeginTag ({1})", NextIndex(), tagKey);
            if (full_trace)
            {
                WriteTrace(new StackTrace());
            }

            base.RenderBeginTag(tagKey);
        }
        protected override bool OnTagRender(string name, HtmlTextWriterTag key)
        {
            output.WriteLine("{0:###0} OnTagRender ({1}, {2})", NextIndex(), name, key);
            if (full_trace)
            {
                WriteTrace(new StackTrace());
            }

            return(base.OnTagRender(name, key));
        }
        protected override string GetTagName(HtmlTextWriterTag tagKey)
        {
            output.WriteLine("{0:###0} GetTagName ({1})", NextIndex(), tagKey);
            if (full_trace)
            {
                WriteTrace(new StackTrace());
            }

            return(base.GetTagName(tagKey));
        }
Example #36
0
 /// <summary>
 /// Determines whether the specified markup element will be rendered to the requesting page.
 /// </summary>
 /// <param name="name">Name.</param>
 /// <param name="key">Tag key.</param>
 /// <returns>True if the markup element should be rendered, false otherwise.</returns>
 protected override bool OnTagRender(string name, HtmlTextWriterTag key)
 {
     // Do not render <span> tags
     if (key == HtmlTextWriterTag.Span)
     {
         return(false);
     }
     // Otherwise, call the base class (always true)
     return(base.OnTagRender(name, key));
 }
        /// <summary>
        /// Write text inside tags of type HtmlTextWriterTag
        /// </summary>
        /// <param name="html">HtmlTextWriter instance object</param>
        /// <param name="value">Input text / string</param>
        /// <param name="tag">Value of HtmlTextWriterTag enumaration</param>
        /// <returns>HtmlTextWriter reference</returns>
        public static HtmlTextWriter InsertText(this HtmlTextWriter html, string value, HtmlTextWriterTag tag)
        {
            CheckNullParam(html);

            html.WriteBeginTag(tag.ToString());
            html.Write(HtmlTextWriter.TagRightChar);
            html.Write(value);
            html.WriteEndTag(tag.ToString());

            return html;
        }
        internal static MvcHtmlString BuildTags(string[] virtualPaths, HtmlTextWriterTag tag)
        {
            var builder = new StringBuilder();

            foreach (var virtualPath in virtualPaths)
            {
                var urls = ResolveUrls(virtualPath);
                foreach (var url in urls)
                    builder.AppendLine(BuildOneTag(url, tag));
            }

            return MvcHtmlString.Create(builder.ToString());
        }
 public static void AddTag(this HtmlTextWriter writer, HtmlTextWriterTag tag,
     Dictionary<string, string> attributes, string value = "")
 {
     foreach (var attribute in attributes)
     {
         writer.AddAttribute(attribute.Key, attribute.Value);
     }
     writer.RenderBeginTag(tag);
     if (value != "")
     {
         writer.Write(value);
     }
     writer.RenderEndTag();
 }
Example #40
0
		private void Test(ref HtmlTextWriterTag testTag)
		{
			try
			{
				this.GHTSubTestBegin("Tag = " + ((HtmlTextWriterTag) testTag).ToString());
				WebControl control1 = new WebControl(testTag);
				this.m_ctrlCounter++;
				control1.ID = "ctrl_" + this.m_ctrlCounter.ToString();
				base.GHTActiveSubTest.Controls.Add(control1);
			}
			catch (Exception exception2)
			{
				// ProjectData.SetProjectError(exception2);
				Exception exception1 = exception2;
				this.GHTSubTestUnexpectedExceptionCaught(exception1);
				// ProjectData.ClearProjectError();
			}
			this.GHTSubTestEnd();
		}
        /// <summary>
		/// 构造函数
        /// Initializes a new ScriptControl
        /// </summary>
        /// <param name="tag"></param>
        public ScriptControlBase(HtmlTextWriterTag tag)
            : this(false, tag)
        {
			
        }
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 protected override string GetTagName(HtmlTextWriterTag tagKey) {
     // div->table substitution.
     if (tagKey == HtmlTextWriterTag.Div && ShouldPerformDivTableSubstitution) {
         return "table";
     }
     return base.GetTagName(tagKey);
 }
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        public override void RenderBeginTag(HtmlTextWriterTag tagKey) {
            // flush string buffers to build new tag
            _beforeTag.Length = 0;
            _beforeContent.Length = 0;
            _afterContent.Length = 0;
            _afterTag.Length = 0;

            _renderFontTag = false;
            _fontFace = null;
            _fontColor = null;
            _fontSize = null;

            // div->table substitution.
            if (ShouldPerformDivTableSubstitution) {
                if (tagKey == HtmlTextWriterTag.Div) {
                    AppendOtherTag("tr", _beforeContent, _afterContent);

                    string alignment;
                    if (IsAttributeDefined(HtmlTextWriterAttribute.Align, out alignment)) {
                        string[] attribs = new string[] { GetAttributeName(HtmlTextWriterAttribute.Align), alignment};

                        AppendOtherTag("td", new object[]{ attribs}, _beforeContent, _afterContent);
                    }
                    else {
                        AppendOtherTag("td", _beforeContent, _afterContent);
                    }
                    if (!IsAttributeDefined(HtmlTextWriterAttribute.Cellpadding)) {
                        AddAttribute(HtmlTextWriterAttribute.Cellpadding, "0");
                    }
                    if (!IsAttributeDefined(HtmlTextWriterAttribute.Cellspacing)) {
                        AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
                    }
                    if (!IsStyleAttributeDefined(HtmlTextWriterStyle.BorderWidth)) {
                        AddAttribute(HtmlTextWriterAttribute.Border, "0");
                    }
                    if (!IsStyleAttributeDefined(HtmlTextWriterStyle.Width)) {
                        AddAttribute(HtmlTextWriterAttribute.Width, "100%");
                    }
                }
            }

            base.RenderBeginTag(tagKey);
        }
 internal Label(HtmlTextWriterTag tag) : base(tag)
 {
 }
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        protected override bool OnTagRender(string name, HtmlTextWriterTag key) {
            // handle any tags that do not work downlevel

            SetTagSupports();
            if (Supports(FONT_PROPAGATE)) {
                FontStack.Push(new FontStackItem());
            }

            // div->table substitution.
            // Make tag look like a table. This must be done after we establish tag support.
            if (key == HtmlTextWriterTag.Div && ShouldPerformDivTableSubstitution) {
                TagKey = HtmlTextWriterTag.Table;
            }

            return base.OnTagRender(name,key);
        }
Example #46
0
 public override void RenderBeginTag(HtmlTextWriterTag tagKey)
 {
     base.RenderBeginTag(tagKey);
     HasRenderedFirstTag = true;
 }
 /// <summary>
 /// Creates the actions menu separator.
 /// </summary>
 /// <param name="parent">The parent.</param>
 /// <param name="name">The name.</param>
 /// <param name="WrapperTagKey">The wrapper tag key.</param>
 /// <param name="cssClass">The CSS class.</param>
 /// <param name="text">The text.</param>
 /// <param name="resourceClassId">The resource class pageId.</param>
 /// <returns></returns>
 public static WidgetElement CreateActionMenuSeparator(
     ConfigElement parent,
     string name,
     HtmlTextWriterTag WrapperTagKey,
     string cssClass,
     string text,
     string resourceClassId)
 {
     return new LiteralWidgetElement(parent)
     {
         Name = name,
         WrapperTagKey = WrapperTagKey,
         CssClass = cssClass,
         Text = text,
         ResourceClassId = resourceClassId,
         WidgetType = typeof(LiteralWidget),
         IsSeparator = true
     };
 }
		public override void RenderBeginTag (HtmlTextWriterTag tagKey)
		{
                        base.RenderBeginTag (tagKey);
		}
Example #49
0
		public WebControl (HtmlTextWriterTag tag) 
		{
			this.tag = tag;
			this.enabled = true;
		}
Example #50
0
 internal static void RenderElement(this HtmlTextWriter writer, HtmlTextWriterTag tag, string format, params object[] arg)
 {
     writer.RenderBeginTag(tag);
     writer.Write(format, arg);
     writer.RenderEndTag();
 }
Example #51
0
		protected WebControl (string tag) 
		{
			this.tag = HtmlTextWriterTag.Unknown;
			this.tag_name = tag;
			this.enabled = true;
		}
Example #52
0
 internal static void RenderElement(this HtmlTextWriter writer, HtmlTextWriterTag tag, object value)
 {
     writer.RenderElement(tag, value.ToString());
 }
Example #53
0
 internal static void RenderElement(this HtmlTextWriter writer, HtmlTextWriterTag tag)
 {
     writer.RenderBeginTag(tag);
     writer.RenderEndTag();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="HttpHandledControl"/> class.
 /// </summary>
 /// <param name="tag">The tag.</param>
 public HttpHandledControl(HtmlTextWriterTag tag)
     : base(tag)
 {
 }
        /// <summary>
		/// 构造函数
        /// Initializes a new ScriptControl
        /// </summary>
		/// <param name="enableClientState">是否使用ClientState</param>
		/// <param name="tag">控件的HtmlTextWriterTag</param>
        protected ScriptControlBase(bool enableClientState, HtmlTextWriterTag tag)
        {
            _tagKey = tag;
            _enableClientState = enableClientState;		
        }
 /// <summary>
 /// Creates the action menu command.
 /// </summary>
 /// <param name="parent">The parent.</param>
 /// <param name="name">The name.</param>
 /// <param name="wrapperTagKey">The wrapper tag key.</param>
 /// <param name="commandName">Name of the command.</param>
 /// <param name="text">The text.</param>
 /// <param name="resourceClassId">The resource class id.</param>
 /// <param name="cssClass">The CSS class.</param>
 /// <returns></returns>
 public static CommandWidgetElement CreateActionMenuCommand(
     ConfigElement parent,
     string name,
     HtmlTextWriterTag wrapperTagKey,
     string commandName,
     string text,
     string resourceClassId,
     string cssClass)
 {
     var commandWidgetElement = DefinitionsHelper.CreateActionMenuCommand(parent, name, wrapperTagKey, commandName, text, resourceClassId);
     commandWidgetElement.CssClass = cssClass;
     return commandWidgetElement;
 }
		protected override bool OnTagRender (string name, HtmlTextWriterTag key)
		{
                        return base.OnTagRender (name, key);
		}
Example #58
0
 /// <summary>
 /// Initializes a new ScriptControl
 /// </summary>
 /// <param name="enableClientState"></param>
 /// <param name="tag"></param>
 protected ScriptControlBase(bool enableClientState, string tag)
 {
     _tagKey = HtmlTextWriterTag.Unknown;
     _tagName = tag;
     _enableClientState = enableClientState;
 }
		protected override string GetTagName (HtmlTextWriterTag tagKey)
		{
			if (tagKey == HtmlTextWriterTag.Unknown ||
			    !Enum.IsDefined (typeof (HtmlTextWriterTag), tagKey))
				return "";

			return tagKey.ToString ().ToLower (CultureInfo.InvariantCulture);
			/* The code below is here just in case we need to split things up
			switch (tagkey) {
			case HtmlTextWriterTag.Unknown:
				return "";
			case HtmlTextWriterTag.A:
				return "a";
			case HtmlTextWriterTag.Acronym:
				return "acronym";
			case HtmlTextWriterTag.Address:
				return "address";
			case HtmlTextWriterTag.Area:
				return "area";
			case HtmlTextWriterTag.B:
				return "b";
			case HtmlTextWriterTag.Base:
				return "base";
			case HtmlTextWriterTag.Basefont:
				return "basefont";
			case HtmlTextWriterTag.Bdo:
				return "bdo";
			case HtmlTextWriterTag.Bgsound:
				return "bgsound";
			case HtmlTextWriterTag.Big:
				return "big";
			case HtmlTextWriterTag.Blockquote:
				return "blockquote";
			case HtmlTextWriterTag.Body:
				return "body";
			case HtmlTextWriterTag.Br:
				return "br";
			case HtmlTextWriterTag.Button:
				return "button";
			case HtmlTextWriterTag.Caption:
				return "caption";
			case HtmlTextWriterTag.Center:
				return "center";
			case HtmlTextWriterTag.Cite:
				return "cite";
			case HtmlTextWriterTag.Code:
				return "code";
			case HtmlTextWriterTag.Col:
				return "col";
			case HtmlTextWriterTag.Colgroup:
				return "colgroup";
			case HtmlTextWriterTag.Dd:
				return "dd";
			case HtmlTextWriterTag.Del:
				return "del";
			case HtmlTextWriterTag.Dfn:
				return "dfn";
			case HtmlTextWriterTag.Dir:
				return "dir";
			case HtmlTextWriterTag.Div:
				return "table";
			case HtmlTextWriterTag.Dl:
				return "dl";
			case HtmlTextWriterTag.Dt:
				return "dt";
			case HtmlTextWriterTag.Em:
				return "em";
			case HtmlTextWriterTag.Embed:
				return "embed";
			case HtmlTextWriterTag.Fieldset:
				return "fieldset";
			case HtmlTextWriterTag.Font:
				return "font";
			case HtmlTextWriterTag.Form:
				return "form";
			case HtmlTextWriterTag.Frame:
				return "frame";
			case HtmlTextWriterTag.Frameset:
				return "frameset";
			case HtmlTextWriterTag.H1:
				return "h1";
			case HtmlTextWriterTag.H2:
				return "h2";
			case HtmlTextWriterTag.H3:
				return "h3";
			case HtmlTextWriterTag.H4:
				return "h4";
			case HtmlTextWriterTag.H5:
				return "h5";
			case HtmlTextWriterTag.H6:
				return "h6";
			case HtmlTextWriterTag.Head:
				return "head";
			case HtmlTextWriterTag.Hr:
				return "hr";
			case HtmlTextWriterTag.Html:
				return "html";
			case HtmlTextWriterTag.I:
				return "i";
			case HtmlTextWriterTag.Iframe:
				return "iframe";
			case HtmlTextWriterTag.Img:
				return "img";
			case HtmlTextWriterTag.Input:
				return "input";
			case HtmlTextWriterTag.Ins:
				return "ins";
			case HtmlTextWriterTag.Isindex:
				return "isindex";
			case HtmlTextWriterTag.Kbd:
				return "kbd";
			case HtmlTextWriterTag.Label:
				return "label";
			case HtmlTextWriterTag.Legend:
				return "legend";
			case HtmlTextWriterTag.Li:
				return "li";
			case HtmlTextWriterTag.Link:
				return "link";
			case HtmlTextWriterTag.Map:
				return "map";
			case HtmlTextWriterTag.Marquee:
				return "marquee";
			case HtmlTextWriterTag.Menu:
				return "menu";
			case HtmlTextWriterTag.Meta:
				return "meta";
			case HtmlTextWriterTag.Nobr:
				return "nobr";
			case HtmlTextWriterTag.Noframes:
				return "noframes";
			case HtmlTextWriterTag.Noscript:
				return "noscript";
			case HtmlTextWriterTag.Object:
				return "object";
			case HtmlTextWriterTag.Ol:
				return "ol";
			case HtmlTextWriterTag.Option:
				return "option";
			case HtmlTextWriterTag.P:
				return "p";
			case HtmlTextWriterTag.Param:
				return "param";
			case HtmlTextWriterTag.Pre:
				return "pre";
			case HtmlTextWriterTag.Q:
				return "q";
			case HtmlTextWriterTag.Rt:
				return "rt";
			case HtmlTextWriterTag.Ruby:
				return "ruby";
			case HtmlTextWriterTag.S:
				return "s";
			case HtmlTextWriterTag.Samp:
				return "samp";
			case HtmlTextWriterTag.Script:
				return "script";
			case HtmlTextWriterTag.Select:
				return "select";
			case HtmlTextWriterTag.Small:
				return "small";
			case HtmlTextWriterTag.Span:
				return "span";
			case HtmlTextWriterTag.Strike:
				return "strike";
			case HtmlTextWriterTag.Strong:
				return "strong";
			case HtmlTextWriterTag.Style:
				return "style";
			case HtmlTextWriterTag.Sub:
				return "sub";
			case HtmlTextWriterTag.Sup:
				return "sup";
			case HtmlTextWriterTag.Table:
				return "table";
			case HtmlTextWriterTag.Tbody:
				return "tbody";
			case HtmlTextWriterTag.Td:
				return "td";
			case HtmlTextWriterTag.Textarea:
				return "textarea";
			case HtmlTextWriterTag.Tfoot:
				return "tfoot";
			case HtmlTextWriterTag.Th:
				return "th";
			case HtmlTextWriterTag.Thead:
				return "thead";
			case HtmlTextWriterTag.Title:
				return "title";
			case HtmlTextWriterTag.Tr:
				return "tr";
			case HtmlTextWriterTag.Tt:
				return "tt";
			case HtmlTextWriterTag.U:
				return "u";
			case HtmlTextWriterTag.Ul:
				return "ul";
			case HtmlTextWriterTag.Var:
				return "var";
			case HtmlTextWriterTag.Wbr:
				return "wbr";
			case HtmlTextWriterTag.Xml:
				return "xml";
			default:
				return "";
			}
			*/
		}
 /// <summary>
 /// Creates the action menu widget element.
 /// </summary>
 /// <param name="parent">The parent.</param>
 /// <param name="name">The name.</param>
 /// <param name="wrapperTagKey">The wrapper tag key.</param>
 /// <param name="commandName">Name of the command.</param>
 /// <param name="text">The text.</param>
 /// <param name="resourceClassId">The resource class pageId.</param>
 /// <returns></returns>
 public static CommandWidgetElement CreateActionMenuCommand(
     ConfigElement parent,
     string name,
     HtmlTextWriterTag wrapperTagKey,
     string commandName,
     string text,
     string resourceClassId)
 {
     return new CommandWidgetElement(parent)
     {
         Name = name,
         WrapperTagKey = wrapperTagKey,
         CommandName = commandName,
         Text = text,
         ResourceClassId = resourceClassId,
         WidgetType = typeof(CommandWidget)
     };
 }