Manos.Mvc.TagBuilder.AddAttribute C# (CSharp) Method

AddAttribute() public method

public AddAttribute ( string name, object value ) : void
name string
value object
return void
        public void AddAttribute(string name, object value)
        {
            Attributes.Add(name, value==null ? null : value.ToString());
        }

Usage Example

        public static void EndForm(this HtmlHelper This)
        {
            var fd = This.GetFormData();

            if (fd.currentForm != null)
            {
                if (fd.FormFields != null)
                {
                    string fields = string.Join(",", fd.FormFields.ToArray());

                    var tag = new TagBuilder("input");
                    tag.AddAttribute("type", "hidden");
                    tag.AddAttribute("name", "_Manos_Mvc_FormFields");
                    tag.AddAttribute("value", md5.Calculate(This.Context.Application.ServerKey + fields) + "/" + fields);

                    This.Output.Write(tag.Render());
                    This.Output.Write("\n");

                    fd.FormFields = null;
                }

                This.Output.Write("</form>");

                var old = fd.currentForm;
                fd.currentForm = old.outer;
                old.Close();
            }
        }
All Usage Examples Of Manos.Mvc.TagBuilder::AddAttribute