I'm reading about igGrid remote paging here : http://help.infragistics.com/NetAdvantage/jQuery/2013.1/CLR4.0?page=igGrid_Paging.html.
As per the link above, it says :
"If you are implementing your own remote service (for example in ASP.NET or PHP), in order to properly initialize and render the pager, your service must specify both the responseDataKey (grid option) and the recordCountKey (paging option). The recordCountKey member tells the Paging widget how many records in total are in the backend. The responseDataKey specifies which property in the response contains the resulting data.
I am returning my data in responseDataKey and recordCountKey but it is not working for me. I have tried by removing [GridDataSourceAction] attribute from my Action.
Below is my code :
CSHTML :
@( Html.Infragistics().Grid<Searchclient>() .ID("igGrid1") .Width("auto") .EnableHoverStyles(false)
// Enable continuous virtualization .PrimaryKey("PartyId1")
.Columns(column => { column.For(x => x.FullName).DataType("string").HeaderText("Full Name").Template("<div style='min-width:100px'>${FullName}</div> ");
//column.For(x => x.TelPremise).DataType("string").HeaderText("Tel Premise").Template("<div style='min-width:100px'>${TelPremise}</div> ");
//column.For(x => x.TelCell).DataType("string").HeaderText("Tel Cell").Template("<div style='min-width:100px'>${TelCell}</div> ");
column.For(x => x.CompanyName).DataType("string").HeaderText("Company Name").Template("<div style='min-width:150px'>${CompanyName}</div> ").Hidden(true); column.For(x => x.FirstName1).DataType("string").HeaderText("FirstName1").Template("<div style='min-width:130px'>${FirstName1}</div> ").Hidden(true); column.For(x => x.LastName1).DataType("string").HeaderText("Last Name1").Template("<div style='min-width:130px'>${LastName1}</div> ").Hidden(true); column.For(x => x.Firstname2).DataType("string").HeaderText("First Name2").Hidden(true); column.For(x => x.Lastname2).DataType("string").HeaderText("Last Name2").Hidden(true); column.For(x => x.StreetNo).DataType("string").HeaderText("Street No").Template("<div style='min-width:100px'>${StreetNo}</div> ").Hidden(true); column.For(x => x.Street).DataType("string").HeaderText("Street").Template("<div style='min-width:100px'>${Street}</div> ").Hidden(true); column.For(x => x.Address).DataType("string").HeaderText("Address").Template("<div style='min-width:100px'>${Address}</div> "); column.For(x => x.City).DataType("string").HeaderText("City").Template("<div style='min-width:80px'>${City}</div> "); column.For(x => x.State).DataType("string").HeaderText("State").Template("<div style='min-width:80px'>${State}</div> "); column.For(x => x.Zipcode).DataType("string").HeaderText("Zipcode").Template("<div style='min-width:100px'>${Zipcode}</div> "); column.For(x => x.CustomerNumber).DataType("string").HeaderText("Customer Number").Hidden(true); column.For(x => x.AccountNumber).DataType("string").HeaderText("Account Number").Template("<div style='min-width:120px'>${AccountNumber}</div> "); column.For(x => x.Email1).DataType("string").HeaderText("Email1").Template("<div style='min-width:100px'>${Email1}</div> "); column.For(x => x.Email2).DataType("string").HeaderText("Email2").Template("<div style='min-width:100px'>${Email2}</div> "); column.For(x => x.Email3).DataType("string").HeaderText("Email3").Hidden(true); column.For(x => x.Email4).DataType("string").HeaderText("Email4").Hidden(true); //column.For(x => x.PartyId).DataType("string").HeaderText("PartyId"); column.For(x => x.PartyId1).HeaderText("PartyId").DataType("int").Hidden(true);
}) .Features(features => {
features.Responsive().ForceResponsiveGridWidth(false).EnableVerticalRendering(false).ColumnSettings(setting => { setting.ColumnSetting().ColumnKey("FullName").Classes("ui-visible-phone ui-visible-tablet ui-visible-desktop").Configuration(conf => conf.AddColumnModeConfiguration("phone", c => c.Template("<span>${FullName}</span>")));
setting.ColumnSetting().ColumnKey("telpremise").Classes("ui-hidden-phone"); setting.ColumnSetting().ColumnKey("firstname1").Classes("ui-visible-desktop"); setting.ColumnSetting().ColumnKey("telcell").Classes("ui-visible-desktop"); setting.ColumnSetting().ColumnKey("street").Classes("ui-visible-desktop"); setting.ColumnSetting().ColumnKey("address").Classes("ui-hidden-phone"); setting.ColumnSetting().ColumnKey("lastname1").Classes("ui-visible-desktop"); setting.ColumnSetting().ColumnKey("email1").Classes("ui-hidden-phone"); setting.ColumnSetting().ColumnKey("address").Classes("ui-hidden-phone"); setting.ColumnSetting().ColumnKey("zipcode").Classes("ui-visible-desktop"); setting.ColumnSetting().ColumnKey("accountnumber").Classes("ui-visible-desktop"); setting.ColumnSetting().ColumnKey("email2").Classes("ui-visible-desktop"); setting.ColumnSetting().ColumnKey("city").Classes("ui-visible-desktop"); setting.ColumnSetting().ColumnKey("state").Classes("ui-hidden-phone"); setting.ColumnSetting().ColumnKey("PartyId1").Classes("ui-hidden-phone");
});
features.Hiding().HiddenColumnIndicatorHeaderWidth(14).ColumnSettings(s => s.ColumnSetting().ColumnKey("CompanyName").AllowHiding(true)); features.Resizing().AllowDoubleClickToResize(true).DeferredResizing(true); features.Paging().Type(OpType.Remote).PageSize(10).PrevPageLabelText("Prev").NextPageLabelText("Next"); features.Sorting().Type(OpType.Local).Mode(SortingMode.Single).ColumnSettings(settings => { settings.ColumnSetting().ColumnKey("PartyId").AllowSorting(true);
}); features.RowSelectors().EnableCheckBoxes(true).EnableRowNumbering(false); features.Selection().MouseDragSelect(false).MultipleSelection(false).Mode(SelectionMode.Row); features.Filtering().Mode(FilterMode.Simple); features.Sorting().Type(OpType.Remote); }) .DataSourceUrl(Url.Action("GetAccountList")) .Width("auto")
.DataBind() .Render() )
CS :
// [GridDataSourceAction] public ActionResult GetAccountList(int page, int pageSize) { if (Session["Condition"] != null) { string condition = (string)Session["Condition"]; var searchlist = DBmain.GetSearchClientPaging(condition, page, pageSize); return Json(new { responseDataKey = searchlist, recordCountKey = 295207 }, JsonRequestBehavior.AllowGet);
} }
Please help. Let me know if you have any question.
Hello Atul,
Since this question is not related to the original one that you asked, I would suggest that you create a new, separate forum thread.
That way everyone who has a similar issue and is looking for a solution would not have to read the whole unrelated prior conversation and would be able to solve his problem in a more efficient manner.
Hi Vasil,
Thanks for your support. I have another question, We want collapse other rows if one row is expanded in our hierarchichal grid.
I was looking intothis post https://es.infragistics.com/community/forums/f/ignite-ui-for-javascript/94943/collapse-other-rows-if-one-row-is-expanded
But solution given there is for Javascript, We need solution for MVC infragistic grid.
I am glad that you find my answer helpful.
Feel free to contact me if you have some additional questions regarding this matter.
Thanks Vasil. You are a life saver
I would suggest that you take a look at the Remote Features online sample – the code for the GetFilterExpressions method is available there, just click the “ASP.NET Controller” tab.
Regarding the SQL queries: the Infragistics controls handle the UI part of an application, hence we do not have such SQL samples, and we do not provide support for database related topics, as it goes beyond the scope of our Support.
On a side note: There is a tool called LinqPad, which has a free version, and has an option to convert LINQ to SQL that you may find useful. There is a Medium post that shows how it is done in more details.