Collection of helpful TagHelpers for any ASP.NET Core project.
13 January 2020
- v3.1.2
-
- Hotfix for issue #8
- Deprected: "PageSizeNavFormMethod" property is no more required, will be removed in a feature release
- "Items per page" renamed to "Page size"
Starting from v3.1.0 all opitons are on by default, can be turned off manually if not needed. See Demo page for more details about all options.
- LocalizeTagHelper (Repository, Demo, Tutorial)
- AlertTagHelper (Docs, Demo)
- LocalizationValidationScriptsTagHelper (Docs, Demo)
- LanguageNavTagHelper (Docs, Demo)
- SelectEnumTagHelper (Docs, Demo)
- PagingTagHelper (Docs, Demo, Tutorial)
- EmailTagHelper
- PhoneNumberTagHelper
Install via nuget :
Install-Package LazZiya.TagHelpers
add tag helper to _ViewImports.cshtml:
@addTagHelper *, LazZiya.TagHelpers
Only few parameters are required to fireup the agination control
- version >= 3.1.0
<paging total-records="Model.TotalRecords"
page-no="Model.PageNo">
</paging>
- version <= 3.0.2
<paging total-records="Model.TotalRecords"
page-no="Model.PageNo"
query-string-value="@(Request.QueryString.Value)">
</paging>
it is important to add query-string-value
for versions before 3.1.0.
For more details :
Use simple html tag to localize text/html in razor views
<localize>Hellow world!</localize>
Requires LazZiya.TagHelpers.Localization and LazZiya.ExpressLocalization nuget packages.
Read more:
- Demo
- Repository
- LazZiya.ExpressLocalization
- Step-by-step tutorial to develop multi-cultural Asp.Net Core 2.2 web app
Easily create bootstrap 4.x alerts from c# backend or razor pages using html codes. All bootstrap alerts can be created from both ends (Primary, Secondary, Success, Info, Warning, Danger, Light, Dark).
<alert-success>Congratulations! you have done the job!</alert-success>
Alert are TempData items, so they will be disposed once they are fetched. You can create alerts from the c# backend by the provided extension methods for TempData as below:
using LazZiya.TagHelpers.Alerts
TempData.Danger("Ooopps! something went wrong with the code, please contact support.");
Then use alert tag helepr on razor side to render the alerts:
- version >= 3.0.1
<alert></alert>
- version <= 3.0.0
<alert view-context="ViewContext"></alert>
Read more :
- version >= 3.0.1
<language-nav></language-nav>
- version <= 3.0.0
<language-nav view-context="ViewContext"></language-nav>
For more details :
will add all required js files and code to validate localized input fields like numbers, date and currency. These scripts will help to validate localized decimal numbers with comma or dot format (e.g. EN culture: 1.2 - TR culture: 1,2).
1- Register tag helper component in startup. Don't apply this step if you are using ExpressLocalization it will be done automatically
services.AddTransient<ITagHelperComponent, LocalizationValidationScriptsTagHelperComponent>()
2- Add this code to the scripts section in the page:
<localization-validation-scripts></localization-validation-scripts>
For more details :
Sample enum :
public enum WeekDays { MON, TUE, WED, THU, FRI, SAT, SUN }
create the related select list dropdown in razor page :
<select-enum
enum-type="typeof(WeekDays)"
name="weekDay">
</select-enum>
For more details :