In my project, I use the load helper in to layout file, like following
<head> <title>@ViewBag.Title</title> @ContentHelper.LinkCSS(Url.Content("~/Resources/Layout/css/Layout.css"))@* @ContentHelper.LinkCSS(Url.Content("~/Resources/Infragistics/css/structure/infragistics.css")) @ContentHelper.LinkCSS(Url.Content("~/Resources/Infragistics/css/themes/infragistics/infragistics.theme.css"))*@ @ContentHelper.Script(Url.Content("~/Resources/Common/JS/jquery-1.5.1.js")) @ContentHelper.Script(Url.Content("~/Resources/Common/JS/jquery-ui-1.8.11.js")) @ContentHelper.Script(Url.Content("~/Resources/Common/JS/modernizr-1.7.min.js")) @ContentHelper.Script(Url.Content("~/Resources/Infragistics/JS/infragistics.loader.js")) @*@ContentHelper.Script(Url.Content("~/Resources/Infragistics/JS/infragistics.js"))*@ @(Html.Infragistics() .Loader() .Resources("igGrid.*") .ScriptPath(Url.Content("~/Resources/Infragistics/JS/")) .CssPath(Url.Content("~/Resources/Infragistics/css/")) .Render())</head>
and put the grid helper into antoher cshtml file, like following.
@( Html.Infragistics().Grid<MockPosition>().ID("MockPositionGrid") .AvgRowHeight("25") .Columns(column => { column.For(x => x.MarketPrice).DataType("number").HeaderText("Price").Format("0.00").Width("80px"); column.For(x => x.Units).DataType("number").HeaderText("Units").Format("0.00").Width("160px"); column.For(x => x.MarketValue).DataType("number").HeaderText("Value").Format("0.00").Width("160px"); column.For(x => x.Cost).DataType("number").HeaderText("Cost").Format("0.00").Width("160px"); column.For(x => x.BookValue).DataType("number").HeaderText("Book Value").Format("0.00").Width("160px"); column.For(x => x.FxUnrealizedGainLoss).DataType("number").HeaderText("FX P/L").Format("0.00").Width("160px"); column.For(x => x.UnrealizedGainLoss).DataType("number").HeaderText("Mkt P/L").Format("0.00").Width("160px"); column.For(x => x.Duration).DataType("number").HeaderText("Duration").Format("0.00").Width("100px"); }) .Features(features => { features.Paging(); features.Sorting(); }) .DataSourceUrl(Url.Action("RequestMockPosition", "Home")) .Width("100%") .Height("100%") .DataBind() .Render()
It does not works.
But if I put the loader and grid into a same file, it works.
Is there any way to allow I put loader into layout file, and put grid into another file?
Hi I have the same situation and I'm trying to use Loader to change localization to Spanish ... No way, the grid is allways in English ... Any idea about what is happening ?
Thanks
@section Grid {
@(Html.Infragistics() .Loader() .ScriptPath(Url.Content("~/Scripts/Infragistics/")) .CssPath(Url.Content("~/Content/Infragistics/")) .Locale("es") .Resources("igGrid.*") .Render() )
@(Html.Infragistics() .Grid(Model) .ID("gridPrincipal") .Width("100%") .Height("100%") .PrimaryKey("IDProjeto") .AutoGenerateColumns(false) .AutoGenerateLayouts(false) .Columns(column => { column.Unbound("Editar").HeaderText("Editar").Width("8%").Template("<center><a href='/Ease_Manager/GP/Projetos?idProjeto=${IDProjeto}' alt='Editar' title='Editar esse projeto.'><i class='glyphicon glyphicon-edit'></i></a></center>"); column.Unbound("Excluir").HeaderText("Excluir").Width("8%").Template("<center><a href='#' onclick='submitExcluir(${IDProjeto})' alt='Excluir' title='Excluir esse projeto.'><i class='glyphicon glyphicon-trash'></i></a></center>"); column.For(x => x.NomeProjeto).HeaderText("Nome").Width("44%"); column.For(x => x.DescricaoProjeto).HeaderText("Descrição").Width("40%"); }) .Features(features => { features.Sorting().Type(OpType.Local).ColumnSettings(setting => { setting.ColumnSetting().ColumnKey("Editar").AllowSorting(false); setting.ColumnSetting().ColumnKey("Excluir").AllowSorting(false);}); features.Paging().Type(OpType.Local); features.Filtering().Type(OpType.Local).ColumnSettings(setting => { setting.ColumnSetting().ColumnKey("Editar").AllowFiltering(false); setting.ColumnSetting().ColumnKey("Excluir").AllowFiltering(false);}); features.ColumnMoving().Mode(MovingMode.Immediate).MoveType(MovingType.Dom).ColumnSettings(setting => { setting.ColumnSetting().ColumnKey("Editar").AllowMoving(false); setting.ColumnSetting().ColumnKey("Excluir").AllowMoving(false);}); ; features.Resizing().ColumnSettings(setting => { setting.ColumnSetting().ColumnKey("Editar").AllowResizing(false); setting.ColumnSetting().ColumnKey("Excluir").AllowResizing(false);}); features.Hiding().ColumnSettings(setting => { setting.ColumnSetting().ColumnKey("Editar").AllowHiding(false); setting.ColumnSetting().ColumnKey("Excluir").AllowHiding(false);}); ; }) .DataSource(ViewBag.ListaProjetos) .DataBind() .Render() )
Glad you like it, Kev :)
Such situations can be tricky to figure out!Cheers!
Thank you SO much for this post! I have been struggling with this all morning, came across this, tried it, and it is finally working.
I greatly appreciate you putting this out there.
Kevin
I see - they must have been left over from my experiments on the sample (sorry about that).Still, glad you liked the solution :)
Borislav- Thanks for the help. If in the example above I remove "@RenderSection("Header", true) " from the _Layout page, and the <div></div> from the view, it works well.