扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:佚名 来源:动态网站制作指南 2007年11月6日
关键字: Windows
<head> <script runat="server" language="c#"> protected void Page_Load(object sender, EventArgs e) { Response.Write("<p>页面的Page_Load事件触发,触发时间是:" + DateTime.Now.ToString()); if (HiddenField1.Value == String.Empty) HiddenField1.Value = "0"; } protected void Button1_Click(object sender, EventArgs e) { Response.Write("<p>Button1_Click为改变Hidden的值前事件触发,触发时间是:" + DateTime.Now.ToString()); HiddenField1.Value = (Convert.ToInt32(HiddenField1.Value) + 1).ToString(); Label1.Text = HiddenField1.Value; } protected void HiddenField1_ValueChanged(object sender, EventArgs e) { Response.Write("<p>HiddenField的 ValueChanged事件触发,触发时间是:" + DateTime.Now.ToString()); } </script> </head> <body> <form id="form1" runat="server"> <div> <asp:HiddenField ID="HiddenField1" runat="server" OnValueChanged="HiddenField1_ValueChanged" /> </div> <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> <br /> <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" /> </form></body> </html> |
<%@ Page EnableViewState="false" %> <head> <script runat="server" language="c#"> protected void Page_Load(object sender, EventArgs e) { if (HiddenField1.Value == String.Empty) HiddenField1.Value = "111"; } protected void Button1_Click(object sender, EventArgs e) { // HiddenField1.Value = (Convert.ToInt32(HiddenField1.Value) + 1).ToString(); Label1.Text = TextBox1.Text; } protected void HiddenField1_ValueChanged(object sender, EventArgs e) { Response.Write("Changed." + DateTime.Now.ToString()); Response.Write(HiddenField1.Value); Response.Write(TextBox1.Text); } </script> </head> <body> <form id="form1" runat="server"> <div> <asp:HiddenField ID="HiddenField1" runat="server" OnValueChanged="HiddenField1_ValueChanged" /> </div> <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> <br /> <asp:TextBox runat=server ID=TextBox1></asp:TextBox> <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" /> </form> </body> </html> |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者