Freeze first column
Freeze first two columns
Freeze first three columns



You can freeze the first N number of columns in a grid - so that when the user scrolls the grid horizontally, the first N columns stay frozen. Just set the Frozen property of the respective columns to true and this is all you need. In order to see a horizontal scrollbar, you need to set Width of the grid to a smaller number than the combined Width properties of all columns in the grid.
using Microsoft.AspNetCore.Http;
using System.Collections.Generic;
using Trirand.Web.Core;

namespace CoreDemo.Models
{
    public class CustomersJqGridModel
    {   
        public CoreGrid CustomersGrid { get; set; }

        public CustomersJqGridModel(HttpContext context)
        {
            CustomersGrid = new CoreGrid(context)
            {
                Columns = new List<CoreColumn>()
                                 {
                                     new CoreColumn { DataField = "CustomerId",
                                                        PrimaryKey = true,
                                                        Frozen = true,
                                                        Width = 60 },
                                     new CoreColumn { DataField = "CompanyName",
                                                        Width = 150,
                                                        Frozen = true},
                                     new CoreColumn { DataField = "ContactName", Width = 150 },
                                     new CoreColumn { DataField = "ContactTitle", Width = 150 },
                                     new CoreColumn { DataField = "Address", Width = 150 },
                                     new CoreColumn { DataField = "ContactName", Width = 150 },
                                     new CoreColumn { DataField = "City", Width = 150 },
                                     new CoreColumn { DataField = "Region", Width = 150 },
                                     new CoreColumn { DataField = "PostalCode", Width = 150 },
                                     new CoreColumn { DataField = "Country", Width = 150 },
                                     new CoreColumn { DataField = "Phone", Width = 150 },
                                     new CoreColumn { DataField = "Fax", Width = 150 }


                                 },
                Width = "650",
                Height = "300"
            };
        }
    }
}
@model CoreDemo.Models.CustomersJqGridModel
@using Trirand.Web.Core
@using CoreDemo.Models;

<!DOCTYPE html>
<html lang="en-us">
<head>
    <meta charset="utf-8">
    <title>jqGrid for ASP.NET Core - Frozen Columns</title>    
    <!-- jQuery runtime minified -->
    <script src="~/js/jquery-3.2.1.min.js" type="text/javascript"></script>
    <!-- The jqGrid localization file we need, English in this case -->
    <script type="text/javascript" src="~/js/trirand/i18n/grid.locale-en.js"></script>
    <!-- The jqGrid client-side javascript -->
    <script type="text/javascript" src="/js/trirand/coregrid.min.js"></script>

    <!-- The jQuery UI theme that will be used by the grid. -->
    <link rel="stylesheet" type="text/css" href="http://code.jquery.com/ui/1.12.1/themes/redmond/jquery-ui.css" />
    <!-- The jQuery UI theme extension jqGrid needs -->    
    <link rel="stylesheet" type="text/css" href="/css/trirand/coregrid.css" />
</head>
<body>
    <div>           
        @Html.Trirand().CoreGrid(Model.CustomersGrid, "FrozenGrid")
    </div>
    <br /><br />
    
        @{ Html.BeginForm("FunctionalityColumnsFreezing", "Grid"); }
            <div style="font-family: Tahoma">
                @Html.RadioButton("columns", "1", ViewData["first"] as bool?) Freeze first column <br />
                @Html.RadioButton("columns", "2", ViewData["second"] as bool?) Freeze first two columns<br />
                @Html.RadioButton("columns", "3", ViewData["third"] as bool?) Freeze first three columns<br />
            </div>
            <br />
            <input type="button" 
                    id="Button1" 
                    value="Freeze columns" onclick="this.form.submit();" /> 
        @{ Html.EndForm(); }
        <br /><br />
    <div>
         @await Component.InvokeAsync("CodeTabs", new { product = "grid", example = "functionalitycolumnsfreezing" })       
    </div>
</body>
</html>
using System;
using System.Collections.Generic;
using System.Linq;

using Microsoft.AspNetCore.Mvc;

using CoreDemo.Models;


namespace CoreDemo.Controllers.Grid
{
    public partial class GridController : Controller
    {
        // This is the default action for the View. Use it to setup your grid Model.
        public ActionResult FunctionalityColumnsFreezing(int? columns)
        {
            // Get the model (setup) of the grid defined in the /Models folder.
            var gridModel = new CustomersJqGridModel(HttpContext);
            var grid = gridModel.CustomersGrid;
            
            if (columns == null)
                columns = 2;

            if (columns == 1)
            {
                grid.Columns[0].Frozen = true;
                grid.Columns[1].Frozen = false;
                grid.Columns[2].Frozen = false;
                ViewData["first"] = true;
            }
            if (columns == 2)
            {
                grid.Columns[0].Frozen = true;
                grid.Columns[1].Frozen = true;
                grid.Columns[2].Frozen = false;
                ViewData["second"] = true;
            }
            if (columns == 3)
            {
                grid.Columns[0].Frozen = true;
                grid.Columns[1].Frozen = true;
                grid.Columns[2].Frozen = true;
                ViewData["third"] = true;
            }
            
            // Setting the DataUrl to an action (method) in the controller is required.
            // This action will return the data needed by the grid
            grid.DataUrl = Url.Action("FunctionalityColumnsFreezing_DataRequested");             
            
            // Pass the custmomized grid model to the View
            return View(gridModel);
        }       

        // This method is called when the grid requests data. You can choose any method to call
        // by setting the CoreGrid.DataUrl property
        public JsonResult FunctionalityColumnsFreezing_DataRequested()
        {
            // Get both the grid Model and the data Model
            // The data model in our case is an autogenerated linq2sql database based on Northwind.
            var gridModel = new CustomersJqGridModel(HttpContext);
            var northWindModel = new NorthWind();

            // return the result of the DataBind method, passing the datasource as a parameter
            // jqGrid for ASP.NET Core automatically takes care of paging, sorting, filtering/searching, etc
            return gridModel.CustomersGrid.DataBind(northWindModel.Customers);
        }
    }
}
Switch theme:


Theming is based on the very popular jQuery ThemeRoller standard. This is the same theming mechanism used by jQuery UI and is now a de-facto standard for jQuery based components. The benefits of using ThemeRoller are huge. We can offer a big set of ready to use themes created by professional designers, including Windows-like themes (Redmond), Apple-like theme (Cupertino), etc. In addition to that any jQuery UI controls on the same page will pick the same theme.

Last, but not least, you can always roll your own ThemeRoller theme, using the superb Theme Editor

To use a theme, simply reference 2 Css files in your Html <head> section - the ThemeRoller theme you wish to use, and the jqGrid own ThemeRoller Css file. For example (Redmond theme):

<link rel="stylesheet" type="text/css" media="screen" href="/themes/redmond/jquery-ui-1.8.2.custom.css" />
<link rel="stylesheet" type="text/css" media="screen" href="/themes/coregrid.css" />