ASP.NET Tutorial/ASP.net Controls/ViewState — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Версия 18:30, 26 мая 2010
Disable ViewState for a certain control
<source lang="csharp">
<%@ Page Language="C#" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server">
protected void btnAdd_Click(object sender, EventArgs e) { Label1.Text = "a"; Label2.Text = "b"; }
</script> <html> <head id="Head1" runat="server">
<title>Disable View State</title>
</head> <body>
<form id="form1" runat="server">
Label 1: <asp:Label id="Label1" EnableViewState="false" Text="0" Runat="server" />
Label 2: <asp:Label id="Label2" Text="0" Runat="server" />
<asp:Button id="btnAdd" Text="Add" OnClick="btnAdd_Click" Runat="server" />
</form>
</body> </html></source>