title: How to avoid using javascript Twice time ASP.NET MVC 5 in layout and view
body: <p>here is my layout page</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  @using System.Web.Optimization;
  &lt;html&gt;
  &lt;head&gt;
  
  &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
  &lt;meta charset="UTF-8"&gt;
  &lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&gt;
  &lt;meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"&gt;
  &lt;meta name="description" content="Metro, a sleek, intuitive, and powerful framework for faster and easier web development for Windows Metro Style."&gt;
  &lt;meta name="keywords" content="HTML, CSS, JS, JavaScript, framework, metro, front-end, frontend, web development"&gt;
  &lt;meta name="author" content=""&gt;
  &lt;title&gt;&lt;/title&gt;
  
  
  @Scripts.Render("~/bundles/jquery")
  @Styles.Render("~/bundles/metro-ui")
  &lt;script src="//cdnjs.cloudflare.com/ajax/libs/select2/4.0.0/js/select2.min.js"&gt;&lt;/script&gt;
  @Styles.Render("~/bundles/metro-ui/css")
  @Styles.Render("~/bundles/css")
  </code></pre>
  
  <p>and so on</p>
  
  <p>and here is my RazorView</p>
  
  <pre><code>@{
  ViewBag.Title = "Index";
  Layout = "~/Views/Shared/_Layout.cshtml";
  }
  
  &lt;script src="~/Scripts/jquery-2.1.4.min.js"&gt;&lt;/script&gt;
  &lt;script src="~/Scripts/metro.min.js"&gt;&lt;/script&gt;
  &lt;script   src="//cdnjs.cloudflare.com/ajax/libs/select2/4.0.0/js/select2.min.js"&gt;&lt;/script&gt;
  &lt;script src="~/Scripts/jquery-ui-1.10.4.custom.min.js"&gt;&lt;/script&gt;
  &lt;link href="~/Content/metro.css" rel="stylesheet" /&gt;
  &lt;script src="~/Scripts/select2.min.js"&gt;&lt;/script&gt;
  &lt;link href="~/Content/css/select2.min.css" rel="stylesheet" /&gt;
  &lt;link href="~/Content/jquery-ui-1.10.4.custom.min.css" rel="stylesheet" /&gt;
  &lt;link href="//cdnjs.cloudflare.com/ajax/libs/select2/4.0.0/css/select2.min.css" rel="stylesheet" /&gt;
  &lt;br /&gt;&lt;br /&gt;
  @using (Html.BeginForm("Search", "Home", FormMethod.Get))
  {
  
  }
  and so on...
  </code></pre>
  
  <p>my Razor View is inherited to Layout how can i use these scripts in my Razor view i don't need to use these scripts again in my Razor View please give me some solution...?</p>