This is a migrated thread and some comments may be shown as answers.

Get Full HTML from TagBuilder Masked Text Box?

0 Answers 114 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
JoeThomas
Top achievements
Rank 1
Veteran
JoeThomas asked on 21 Jul 2019, 05:55 AM

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?

 

No answers yet. Maybe you can help?

Tags
General Discussions
Asked by
JoeThomas
Top achievements
Rank 1
Veteran
Share this question
or