Extensions

« Form2
Name Movie Genre
The Godfather Mob Details
Citizen Kane Drama Details
The Shawshank Redemption Drama Details
Pulp Fiction Action Details
Casablanca Drama Details

Grid

@(await Html
    .SimpleGrid(Model)
    .AddColumnFor(movie => movie.Name)
    .AddColumnFor(movie => movie.Genre)
    .AddColumn(col => col
        .MyGoogleSearchButton("Details", movie => movie.Name))
    .MyFavoriteGridStuff()
    .RenderAsync())

Custom Extensions

public static SimpleGrid<T> MyFavoriteGridStuff<T>(
    this SimpleGrid<T> grid) where T : class 
    => grid
        .Css(elements => elements.Table.AddClass("table-striped"))
        .AddPager(options =>
        {
            options.TopAndBottom();
            options.RowsPerPage = 5;
            options.RowsPerPageOptions = new[] { 5, 10, 25 };
        });

public static ColumnBuilder<T> MyGoogleSearchButton<T>(
    this ColumnBuilder<T> col,
    string text,
    Func<T, string> queryBuilder) where T : class 
    => col
        .Display(text)
        .LinkTo(
            linkBuilder: model =>
            {
                string query = queryBuilder(model);
                string encoded = System.Web.HttpUtility.UrlEncode(query);
                return $"https://www.google.com/search?q={encoded}";
            }, 
            target: "_blank",
            css: css => css.AddClass("btn btn-primary"));

You can create your own extensions for either the entire Grid, or for Column Builder to encapsulate common setup you use in your app. Just copy and paste these templates above into your own static extension class and modify to your needs.