Testing
unknown
razor
3 years ago
2.0 kB
2
Indexable
Never
<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width" /> <title>@ViewBag.Title</title> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous"> <script src="~/Scripts/jquery-3.5.0.min.js"></script> </head> <body> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script> @{ string[] menu = new string[3] { "Index", "About", "Contact" }; for(int i = 0; i < 3; ++i) { if (String.Equals(ViewBag.Title, menu[i])) { menu[i] = "active"; } else { menu[i] = ""; } } } <nav class="navbar navbar-expand-lg navbar-light bg-light"> <a class="navbar-brand" href="#">Coşkun</a> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button> <div class="collapse navbar-collapse" id="navbarNavAltMarkup"> <div class="navbar-nav"> <a class="nav-item nav-link @(menu[0])" id="Index" href="/Home/Index">Home</a> <a class="nav-item nav-link @(menu[1])" id="About" href="/Home/About">About</a> <a class="nav-item nav-link @(menu[2])" id="Contact" href="/Home/Contact">Contact</a> </div> </div> </nav> <hr /> <div class="block"> @RenderBody() </div> <hr /> <div class="block"> <b>© Tüm Hakları Saklıdır.</b> </div> </body> </html>