LoginSignup
1
1

More than 5 years have passed since last update.

ASP.NetのWebFormsのMasterPageってこんな風に書いておくと捗りそう

Posted at

ASP.NetのWebFormsのMasterPageってこんな風に書いておくと捗りそう

世間では既にASP.Net MVCの時代になってるみたいですが、今更ASP.NetのWebFormsをはじめました

まずはこんな風に書いておくと捗りそう

<%@ Master Language="VB" AutoEventWireup="false" CodeBehind="MasterPage.master.vb" Inherits="Sample.MasterPage" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">

<script>
    history.forward();
</script>

<head runat="server">
    <title></title>
    <link href="Content/bootstrap.css" rel="stylesheet" />
    <asp:ContentPlaceHolder ID="head" runat="server" />
</head>
<body>
    <form id="form1" runat="server">
        <asp:ContentPlaceHolder ID="body" runat="server" ViewStateMode="Disabled" />
        <script src="Scripts/jquery-3.1.1.js"></script>
        <script src="Scripts/bootstrap.js"></script>
    </form>
</body>

</html>

こう書くとなにができてる?

  • ブラウザの「戻る」ボタンを無効にしている
  • ViewStateを無効にしている
  • bootstrap対応になっている

bootstrap対応にするには

PM> Install-Package bootstrap

も忘れずに

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1