TASLibStandard 2.0.27
dotnet add package TASLibStandard --version 2.0.27
NuGet\Install-Package TASLibStandard -Version 2.0.27
<PackageReference Include="TASLibStandard" Version="2.0.27" />
<PackageVersion Include="TASLibStandard" Version="2.0.27" />
<PackageReference Include="TASLibStandard" />
paket add TASLibStandard --version 2.0.27
#r "nuget: TASLibStandard, 2.0.27"
#:package TASLibStandard@2.0.27
#addin nuget:?package=TASLibStandard&version=2.0.27
#tool nuget:?package=TASLibStandard&version=2.0.27
TASLibStandard
A .NET library for Web projects by True Arrow Software: data-grid HTML generation, SQL Server / MySQL data access, and everyday helpers, built for ASP.NET (net8.0).
Install
dotnet add package TASLibStandard
What's included
| Area | Highlights |
|---|---|
| Grid | Grid<T> builds a sortable, pageable, filterable HTML table from SQL or an API/list source. See Grid. |
| Data access | IDatabase with SQLServerDB and MySQLServerDB; QueryBuilder for SQL assembly; DBData + [DatabaseField] for field mapping; GetData<T> maps rows straight to your classes. |
IEmailService / EmailOption abstraction. |
|
| Security | Encryption / EncryptionV2 helpers. |
| Files & FTP | FileHelper, FTPHelper. |
| Extension methods | ToLong, ToFloat, IsNumeric, UcWord, RemoveSpecialCharacters, ToCurrencyStyle, GetDescriptionfromValue (enums), and more. |
Setup
Register the library once in Program.cs: UseTASCore registers IGridFactory, and you register the IDatabase it (and your code) uses:
using TASLibStandard.Data;
using TASLibStandard.Utility;
builder.Services.UseTASCore(connectionString, DBUtilityProvider.SqlServer); // or DBUtilityProvider.MySQL
builder.Services.AddScoped<IDatabase>(_ => DBUtility.CreateDatabase(DBUtilityProvider.SqlServer, connectionString));
Then inject IDatabase for queries and IGridFactory for grids:
using TASLibStandard.Data;
using TASLibStandard.Grid;
public class ItemsController(IDatabase db, IGridFactory grids) : Controller
{
public IActionResult Index()
{
// Typed query with parameters
List<Item> items = db.GetData<Item>(
"select Id, Name, Price from Items where Price > @min",
[new Parameter("@min", 10)]);
// Grid from the factory (already wired to the same database); configure it as shown below
var grid = grids.Create<Item>();
return Content(grid.GetGrid(), "text/html");
}
}
Grid
The Grid<T> component (TASLibStandard.Grid namespace) generates a fully-featured HTML table from a SQL query or an API data source.
Key Features
| Feature | Description |
|---|---|
| Dual Data Source | Fetch data via SQL (QueryBuilder) or an API delegate / pre-loaded list (GridDataSource.SQL / GridDataSource.API). |
| Pagination | Built-in page navigation with configurable page size and page number. |
| Column Sorting | Clickable column headers with ascending/descending sort indicators (Font Awesome icons). |
| Row Sorting | Optional drag-style row reordering with a callback URL (RowSortURL). |
| Bulk Selection | Checkbox column for selecting multiple rows at once. |
| Rich Field Types | 20+ field types including STRING, INTEGER, CURRENCY, DATE, DATETIME, PHONE, FLAG, PERCENTAGE, LINK, PASSWORD, CALLBACK, and more (see FieldType enum). |
| Action Icons | Per-row action buttons (edit, delete, view, download, etc.) driven by Font Awesome icons (ActionIcon enum). Supports conditional rendering via a callback. |
| Cell & Row Customization | Delegate-based hooks (GridColumns.CellCustomizer, GridRow.RowCustomizer) to inject custom HTML attributes or content. |
| Secondary Value | A second value under the main one in the same cell (GridColumns.Secondary), with its own sorting, filter and format. |
| Row Totals | Automatic footer totals for numeric columns (ShowRowTotal). |
| Record Count | Optional total record count display, with the ability to show a specific column's aggregate instead. |
| Database Abstraction | Pluggable IDatabaseInstance — works with SQLServerDB, MySQLServerDB, or any custom implementation. |
Quick Start
using TASLibStandard.Grid;
var grid = new Grid<MyModel>
{
PrimaryKeyFieldName = "Id",
GridURL = "/items",
AllowPagination = true,
IsColumnSortable = true,
PageSize = 25,
Columns = new List<GridColumns>
{
new GridColumns { Header = "Name", SortColumn = "Name", FieldType = FieldType.STRING },
new GridColumns { Header = "Price", SortColumn = "Price", FieldType = FieldType.CURRENCY },
new GridColumns { Header = "Created", SortColumn = "CreatedOn", FieldType = FieldType.DATE }
},
Icons = new List<GridAction>
{
new GridAction("data-action='edit'", ActionIcon.Edit.GetDescriptionfromValue()) { URL = "/items/edit/", RollOverText = "Edit" },
new GridAction("data-action='delete'", ActionIcon.Delete.GetDescriptionfromValue()) { URL = "/items/delete/", RollOverText = "Delete" }
}
};
// SQL data source (default)
grid.Query.SelectFrom = "Items";
grid.Query.SelectColumn = "Id, Name, Price, CreatedOn";
string html = grid.GetGrid();
Using an API Data Source
grid.DataSource = GridDataSource.API;
grid.ApiDataFetcher = (page, size, sortCol, sortDir) =>
{
var result = myService.GetItems(page, size, sortCol, sortDir);
return new ApiDataResult<MyModel>(result.Items, result.Total);
};
string html = grid.GetGrid();
Secondary value in a cell
A column can carry a second column drawn under its value, e.g. Company Code in grey under Company Name. Select both as plain columns (no HTML in the SQL); each part keeps its own sort and filter.
new GridColumns
{
Header = "Company", SortColumn = "c.Name", FieldType = FieldType.STRING,
Secondary = new GridColumns { Header = "Code", SortColumn = "c.Code", FieldType = FieldType.STRING }
}
- Cell:
<div class="gridcell-main">and<div class="gridcell-sub">(left out when the value is empty); the<td>getsgridhassub. The library sets no colours: style.gridcell-subin your CSS. - Header: the column header, with
(Code)below it (gridhead-sub). Each is its own sort link (by=c.Name/by=c.Code). - Filter row (
EnableFilters): one cell, the main filter with the secondary's under it, posted asgrid-{UniqueName}-Nameandgrid-{UniqueName}-Code(the field names). As always the grid does not filter: readGetFilterValue("Code")and add aQuery.Conditionsentry onc.Code.Secondary.DisableFilter/Secondary.Filterwork as on any column. Two filters with one name throw whenGenericSettings.ThrowExceptionis on. - Totals:
ShowRowTotalonly totals the main column; the secondary's total is not shown. - Only one level: a Secondary's own Secondary is ignored.
Sort column safety
With the SQL data source, Directionby (the by of the URL) goes into ORDER BY. Only column names are accepted (Name, c.Name, [Name] or a comma list of them); anything else is dropped and the default sort is used.
Core Types
| Type | Kind | Purpose |
|---|---|---|
Grid<T> |
Class | Main grid builder — configures columns, actions, pagination, sorting, and renders HTML. |
GridColumns |
Class | Defines a single column: header, sort column, field type, format, CSS class, and cell customizer. |
GridAction |
Struct | Defines a per-row action button with icon, URL, tooltip, and optional callback. |
GridRow |
Class | Row-level customizer — attach a delegate to inject HTML attributes on each <tr>. |
GridStatus |
Static Class | Global active/inactive icon and URL configuration for flag columns. |
FieldType |
Enum | Column data types: INTEGER, FLOAT, CURRENCY, STRING, DATE, DATETIME, TIME, PHONE, FLAG, FLAGWITHURL, IMAGE, ICON, CALLBACK, PERCENTAGE, LINK, PASSWORD, MINUTESECOND, and more. |
ActionIcon |
Enum | Predefined Font Awesome icons: Edit, View, Delete, Active, Inactive, Upload, Download, Share, URL, etc. |
GridDataSource |
Enum | SQL or API — controls where the grid fetches its data. |
ApiDataResult<T> |
Class | Wrapper returned by the API delegate containing Data and TotalCount. |
License
MIT © True Arrow Software
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- CsvHelper (>= 33.1.0)
- Humanizer (>= 3.0.10)
- Microsoft.Data.SqlClient (>= 7.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.5)
- Microsoft.SqlServer.Types (>= 170.1000.7)
- MySqlConnector (>= 2.5.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.0.27 | 104 | 10/28/2026 |
| 2.0.26 | 185 | 5/26/2026 |
| 2.0.25 | 169 | 3/13/2026 |
| 2.0.24 | 146 | 2/8/2026 |
| 2.0.22 | 157 | 1/25/2026 |
| 2.0.21 | 154 | 1/11/2026 |
| 2.0.20 | 153 | 12/31/2025 |
| 1.0.18 | 369 | 6/15/2023 |
| 1.0.17 | 614 | 7/3/2021 |
| 1.0.16 | 482 | 6/24/2021 |
| 1.0.15 | 669 | 3/14/2021 |
| 1.0.13 | 580 | 2/25/2021 |
| 1.0.12 | 549 | 1/26/2021 |
| 1.0.11 | 563 | 1/6/2021 |
| 1.0.10 | 594 | 12/17/2020 |
| 1.0.9 | 819 | 12/11/2020 |
| 1.0.8 | 591 | 11/24/2020 |
| 1.0.7 | 677 | 5/22/2020 |