Asp.Net (Html 5) Button

retracting what i wrote lately, i had postback issues, seemed that the simple sln was the thing:

public class html5Button : Button
        protected override string TagName
            get { return "button"; }

        protected override HtmlTextWriterTag TagKey
            get { return HtmlTextWriterTag.Button; }
        // Create a new implementation of the Text property which
        // will be ignored by the parent class, giving us the freedom
        // to use this property as we please.
        public new string Text
            get { return ViewState["NewText"] as string; }
            set { ViewState["NewText"] = HttpUtility.HtmlDecode(value); }
        protected override void OnPreRender(System.EventArgs e)
            // I wasn't sure what the best way to handle 'Text' would
            // be. Text is treated as another control which gets added
            // to the end of the button's control collection in this
            LiteralControl lc = new LiteralControl(this.Text);
            // Add a value for base.Text for the parent class
            // If the following line is omitted, the 'value'
            // attribute will be blank upon rendering
            base.Text = UniqueID;
        protected override void RenderContents(HtmlTextWriter writer)



Popular posts from this blog

c# Service Play Sound with NAudio example by Moshe

SOLVED The item could not be indexed successfully because the item failed in the indexing subsystem

JS/JQ simulate Enter event