Shashank
Shashank

Reputation: 31

jquery ui.css and js files not applied to all pages

I am working with Visual Studio .In my project there is a layout file in which jquery ui.css and jquery-ui.js files are included (path is correct and files are not corrupted ). But it is not taking those files in all respective files like eg:-

Index page, contact us and my usage for the above css and js is in many files. If I include them in that particular page e.g. if i include in home page I can see the expected result only on home page and all other pages remains unchanged.

So my question is:

Why are these files are not getting applied in all pages though I am keeping them in layout?

What I have done - I have checked all paths and even checked if any file is linked twice by some mistake.

My Code:

Index file:

@{
    ViewBag.Title = "Something";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

Layout file:

@{
    Layout = null;
}
<!doctype html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <script src="~/js/jquery-ui.js"></script>
   <link href="~/Content/jquery-ui.css" rel="stylesheet" />
</head>

Upvotes: 0

Views: 70

Answers (1)

jrath
jrath

Reputation: 990

Always put CSS at the top. then script files. Check whether the paths are correct and file have included. And you need to include jQuery as well.

<head>
    <link href="~/Content/jquery-ui.css" rel="stylesheet" />
    <script src="path_to/jquery.js"></script>
    <script src="~/js/jquery-ui.js"></script>

</head>

Upvotes: 1

Related Questions