我有一个使用母版页的页面。
我在页面上禁用了viewstate(而不是母版页),我没注意到viewstate已经缩减了。
好主页设置是否会覆盖它?
答案 0 :(得分:0)
在我的测试设置中EnabledViewState = "False"
不会减少网页的视图状态,而设置ViewStateMode="Disabled"
会降低视图状态
母版页
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="ViewStateTest.master.cs" Inherits="Sample.ViewStateTest" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
</form>
儿童页面
<%@ Page Title="" Language="C#" MasterPageFile="~/ViewStateTest.master" AutoEventWireup="true" CodeBehind="ViewstateTestPage.aspx.cs" Inherits="Sample.ViewstateTestPage" ViewStateMode="Disabled" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<asp:TextBox runat="server"></asp:TextBox>
</asp:Content>