Loading from inside partialview js/css

Asked

Viewed 256 times

0

Good morning,insira o código aqui

I am unable to load . js/. css when loading the partialview

in the layout

<!DOCTYPE html>
<html>

<head>
    ...
    @RenderSection("header", required: false)
</head>

<body>
    ...
    @RenderSection("scripts", required: false)
</body>
</html>

in the index view

@section header{
    @Styles.Render(...)<carrega de boa>
    @Scripts.Render(...)<carrega de boa>
}

@{
    ViewBag.Title = "Usuários";
}

<div class="row">
    @Html.Partial("~/Views/Cadastros/_ListaUsuarios.cshtml")

</div>

@section Scripts {
     ...
}

in partialview

@section header{
    @Scripts.Render("~/Content/plugins/datatables/js")  <<<<<<<<<<<<<<<<NÃO CARREGA>
}

<table id="#example" class="table-striped table-bordered tableHeader-skin-blue" style="width:100%">
    <thead>
        <tr>
            ....
        </tr>
    </thead>
    <tbody>
        ...
    </tbody>
</table>

I wonder why the script I put in partialview is not being added to html?

Would anyone know to tell me?

1 answer

0

Your web.config is allowing debug?

 <system.web>
    <compilation debug="true|false" />

As you are only using a javascript file, it sometimes pays more to call it in the native method:

<script src="~/Content/plugins/datatables/arquivo_min.js"></script>

And you can center all your js and css files in the default layout(master page), or on the parent page.

If it still doesn’t work, run a F12 in Chrome and see the Console tab for errors on your page, you’ll probably be telling us what the error is.

Anything sticks here the mistake for us.

  • Thank you Fabricio, i’m putting: @Section header{ @Scripts.Render("~/Content/plugins/datatables/js") } na partial and is not even added on the page. (which will be a user table didn’t want to spend every waking hour declaring this guy).

  • And did it work by changing some of the things I said? Tried to see the Chrome console error?

  • Yes as debug and working, just does not load the dll, the partial header Section is not loaded in the page header

Browser other questions tagged

You are not signed in. Login or sign up in order to post.