TASLibStandard 2.0.27

dotnet add package TASLibStandard --version 2.0.27
                    
NuGet\Install-Package TASLibStandard -Version 2.0.27
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="TASLibStandard" Version="2.0.27" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TASLibStandard" Version="2.0.27" />
                    
Directory.Packages.props
<PackageReference Include="TASLibStandard" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add TASLibStandard --version 2.0.27
                    
#r "nuget: TASLibStandard, 2.0.27"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package TASLibStandard@2.0.27
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=TASLibStandard&version=2.0.27
                    
Install as a Cake Addin
#tool nuget:?package=TASLibStandard&version=2.0.27
                    
Install as a Cake Tool

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.
Email 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> gets gridhassub. The library sets no colours: style .gridcell-sub in 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 as grid-{UniqueName}-Name and grid-{UniqueName}-Code (the field names). As always the grid does not filter: read GetFilterValue("Code") and add a Query.Conditions entry on c.Code. Secondary.DisableFilter / Secondary.Filter work as on any column. Two filters with one name throw when GenericSettings.ThrowException is on.
  • Totals: ShowRowTotal only 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
Loading failed