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
510
If I use Html.Infragistics().Loader() to load resource, can I put the load helper into layout file?
posted

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?

Parents Reply Children