Awesome Web-Forms Controls

Grid nesting demo

The awesome grid can have multiple nests, an url or js func can be specified for loading the nest content.
When using url the Key of the grid is sent as "Key" parameter to the url.
The class of the html element that will act as a toggle button for the nest needs to be specified, that element will get the awe-on class additionally while its nest is open. Opening a nest will close other nests that are open for the same row.

Master detail grid

Using one nest with url to achieve a master detail grid view

using grid api to open, close and toggle open nest for the first row:

<% MasterDetailGrid.Grid()
new Column { ClientFormat = "<div class='detailnst'><i class='caretc'><i class='o-caret'></i></i> .Id</div>", Width = 100, Header = "Id" },
new Column { Bind = "Person" },
new Column { Bind = "Food" },
new Column { Bind = "Location" })
.Url(Page.Url().Action("GetItems", "LunchGrid"))
.Nests(new Nest { Name = "detailnst", Url = Page.Url().Action("LunchDetail", "GridNestingDemo"), LoadOnce = true }); %>
<awe:Ocon runat="server" ID="MasterDetailGrid" />
using grid api to open, close and toggle open nest for the first row:
<button type="button" class="awe-btn" id="btnOpenNest">Open nest</button>
<button type="button" class="awe-btn" id="btnCloseNest">Close nest </button>
<button type="button" class="awe-btn" id="btnToggleNest">Toggle nest</button>

$(function () {
var grid = $('#<%=MasterDetailGrid.ClientID %>');
var api ='api');

$('#btnToggleNest').click(function () {
api.nestToggle(grid.find('.awe-row:first'), 'detailnst');

$('#btnOpenNest').click(function () {
api.nestOpen(grid.find('.awe-row:first'), 'detailnst');

$('#btnCloseNest').click(function () {
api.nestClose(grid.find('.awe-row:first'), 'detailnst');

.detailnst {
cursor: pointer;

.caretc {
position: relative;
padding: 0 .7em;
margin-right: .5em;

.caretc .o-caret {
transform: rotate(-90deg);
zoom: 1.1;

.detailnst-on .caretc .o-caret {
transform: rotate(-45deg);
public class LunchGridController : Controller
public ActionResult GetItems(GridParams g, string person, string food, int? country)
food = (food ?? "").ToLower();
person = (person ?? "").ToLower();

var list = Db.Lunches
.Where(o => o.Food.ToLower().Contains(food) && o.Person.ToLower().Contains(person))

if (country.HasValue) list = list.Where(o => o.Country.Id == country);

return Json(new GridModelBuilder<Lunch>(list, g)
KeyProp = o => o.Id,// needed for Entity Framework | nesting | tree | api
Map = o => new
Date = o.Date.ToShortDateString(),
CountryName = o.Country.Name,
ChefName = o.Chef.FirstName + " " + o.Chef.LastName
public ActionResult LunchDetail(int key)
var lunch = Db.Get<Lunch>(key);
return PartialView(lunch);
@model AwesomeWebFormsDemo.Models.Lunch
<div style="padding:0.2em 2em;">
@Model.Person had @Model.Food at @Model.Location in @Model.Country.Name<br/>
View loaded from server at: @DateTime.UtcNow UTC

Nested grids / Hierarchical grid

the url of the nest points to an action that will render another grid, it also receives the key of the row (Id) as a parameter to filter it's content
<% CategoriesGrid.Grid()
.Url(Page.Url().Action("CategoriesGrid", "Data"))
.Columns(new Column { Bind = "Name", ClientFormat = "<div class='detailnst'><i class='caretc'><i class='o-caret'></i></i> .Name</div> " })
.Nests(new Nest { Name = "detailnst", Url = Page.Url().Action("MealGrid", "GridNestingDemo"), LoadOnce = true }); %>
<awe:Ocon runat="server" ID="CategoriesGrid" />
public ActionResult MealGrid(int key)
ViewData["Id"] = key;
return PartialView();
<div style="margin: 5px;">
@(Html.Awe().Grid("MealsGrid" + ViewData["Id"]) // please note, you need to have unique html ids
.Url(Url.Action("ChildMealsGrid", "Data"))
new Column { Bind = "Id", Width = 50 },
new Column { Bind = "Name", Width = 150 },
new Column { Bind = "Description" })
.Parameter("categories", ViewData["Id"]))
public ActionResult CategoriesGrid(GridParams g)
return Json(new GridModelBuilder<Category>(Db.Categories.AsQueryable(), g)
Key = "Id"

public ActionResult ChildMealsGrid(GridParams g, int[] categories)
categories = categories ?? new int[] { };

return Json(new GridModelBuilder<Meal>(Db.Meals
.Where(o => categories.Contains(o.Category.Id)).AsQueryable(), g).Build());


We use cookies to improve your online experience. By accessing this site, you agree to the use of cookies and other technologies to process your personal data (e.g. IP address) to enhance and personalise your experience across our websites. Additionally, third-party companies, may store cookies on your device and use similar technologies to collect and use certain information. For more information, refer to our privacy policy and cookie policy.