Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
20
.NET Core razor pages (not controller) Igrid binding
posted

Hi,

I have created application .NET Core 3.x using razor pages. I am not sure how to binding works for the Igrid. Could you help me with binding works on this.

It's my cshtml.cs

[ActionName("GetRoles")]

public async Task OnGetAsync()

{

Role = await _context.Role

.Include(r => r.App).ToListAsync();

//GridModel gridModel = new GridModel();

//gridModel.ID = "grid1";

//gridModel.DataSource = _context.Role.AsQueryable();

//var paging = new GridPaging();

}

It's my razor page cshtml

@(Html.Infragistics()

.Grid(Model)

.ID("grid")

.Width("100%")

.Height("500px")

.PrimaryKey("RoleId")

.AutoGenerateColumns(false)

.AutoGenerateLayouts(false)

.Columns(column =>

{

column.For(x => x.RoleId).HeaderText("RoleId").Width("30%");

column.For(x => x.Description).HeaderText("Description").Width("30%");

})

.Features(features =>

{

features.Sorting().Type(OpType.Remote);

features.Paging().Type(OpType.Remote);

features.Filtering().Type(OpType.Remote);

features.Responsive().ColumnSettings(cs =>

{

cs.ColumnSetting().ColumnKey("RoleId").Classes("ui-hidden-phone");

cs.ColumnSetting().ColumnKey("Description").Classes("ui-hidden-phone ui-hidden-tablet");

});

})

.DataSourceUrl(Url.Action("GetRoles"))

.Render()

)