)>}]
شركة التطبيقات المتكاملة لتصميم وبرمجة البرمجيات الخاصة ش.ش.و.
Integrated Applications Programming Company
Home » Code Library » TagHelper (Ia.Cl.Models.T)

Public general use code classes and xml files that we've compiled and used over the years:

TagHelper for ASP.Net Core.

    1: using Microsoft.AspNetCore.Razor.TagHelpers;
    2: using Microsoft.Extensions.Configuration;
    3: using System.Text;
    4:  
    5: namespace Ia.Cl.Models.T
    6: {
    7:     ////////////////////////////////////////////////////////////////////////////
    8:  
    9:     /// <summary publish="true">
   10:     /// TagHelper for ASP.Net Core.
   11:     /// </summary>
   12:     /// <remarks> 
   13:     /// Copyright � 2023-2024 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
   14:     ///
   15:     /// This library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
   16:     /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
   17:     ///
   18:     /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
   19:     /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
   20:     /// 
   21:     /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
   22:     /// 
   23:     /// Copyright notice: This notice may not be removed or altered from any source distribution.
   24:     /// </remarks> 
   25:     public static class TagHelper
   26:     {
   27:         /*
   28: _ViewImports.cshtml (second line is the important change):
   29: 
   30: @using Ia.Cl.Models.TagHelper
   31: @addTagHelper *, TagHelper  
   32: 
   33: *.cshtml:
   34: 
   35:     <first-tag-helper name="Jignesh Trivedi"/>      
   36:         */
   37:  
   38:         private static IConfigurationRoot _configuration;
   39:  
   40:         ////////////////////////////////////////////////////////////////////////////
   41:  
   42:         /// <summary>
   43:         ///
   44:         /// </summary>
   45:         [HtmlTargetElement("first-tag-helper")]
   46:         public class FirstTagHelper : Microsoft.AspNetCore.Razor.TagHelpers.TagHelper
   47:         {
   48:             /// <summary/>
   49:             public string Name { get; set; }
   50:  
   51:             /// <summary/>
   52:             public override void Process(TagHelperContext context, TagHelperOutput output)
   53:             {
   54:                 output.TagName = "FirstTagHelper";
   55:                 output.TagMode = TagMode.StartTagAndEndTag;
   56:  
   57:                 var sb = new StringBuilder();
   58:                 sb.AppendFormat("<span>Hi! {0}</span>", this.Name);
   59:  
   60:                 output.PreContent.SetHtmlContent(sb.ToString());
   61:             }
   62:  
   63:             ////////////////////////////////////////////////////////////////////////////
   64:             ////////////////////////////////////////////////////////////////////////////
   65:         }
   66:  
   67:         ////////////////////////////////////////////////////////////////////////////
   68:         ////////////////////////////////////////////////////////////////////////////
   69:     }
   70:  
   71:     ////////////////////////////////////////////////////////////////////////////
   72:     ////////////////////////////////////////////////////////////////////////////
   73: }