Get Full HTML from TagBuilder Masked Text Box?

1 posts, 0 answers
  1. JoeThomas
    JoeThomas avatar
    10 posts
    Member since:
    Jun 2019

    Posted 21 Jul 2019 Link to this post

    Anyone know how to go into a Taghelper output, and receive the full HTML markup for Masked TextBox?

    The following was not working:

    output (only gave some of the html)

    output.GetChildContentAsync().GetContent();   (Was Not working !!)

     

    It Should look like this,

                <span class="k-widget k-maskedtextbox" style="">

                    <input id = "test" name="test" data-role="maskedtextbox" class="k-textbox" autocomplete="off" style="width: 100%;">
                    <span class="k-icon k-i-warning"></span>
                 </span>

                  <script>kendo.syncReady(function(){jQuery("#test").kendoMaskedTextBox({"rules":{}});});</script>

     

    This is our Taghelper Edit Code,

    namespace Test.Web.UI.TagHelpers

    {
        [HtmlTargetElement(HtmlTargetElementConts.SearchTextBox)]
        public class TestTextBoxTagHelperGeneral : MaskedTextBoxTagHelper
        {

            [HtmlAttributeName]
            public bool Bold { get; set; }

            [HtmlAttributeName]
            public int? Height { get; set; }

            [HtmlAttributeNotBound]
            public int DefaultHeight { get { return 50; } }

            public IptsTextBoxTagHelperGeneral(IKendoHtmlGenerator generator) : base(generator)
            {
            }

            public override void Process(TagHelperContext context, TagHelperOutput output)
            {
                if (Bold || Height.HasValue)
                {
                    if (Height.HasValue)
                        output.Attributes.Add("style", "height:" + Height + "px");
                    else
                        output.Attributes.Add("style", "height:" + DefaultHeight + "px");
                }
                Name = "test";
                base.Process(context, output);

    How do I Get the Final HTML Markup?

     

Back to Top