Jack-Leung

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

页面:

View Code
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title></title>

<script type="text/javascript">
function reset() {
if (document.getElementById("txtHid").value = "1") {
Pagemothods.InitData();
}

}

</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<input type="hidden" id="txtHid" runat="server" value="0" />
<input type="button" id="BtnReset" runat="server" onclick="reset()"/>
</div>
</form>
</body>
</html>

后台:

View Code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebApplication1
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
TextBox1.Text = "test";
txtHid.Value = "1";
}
}
}
}




posted on 2012-01-26 17:44  Jack.leung  阅读(285)  评论(0编辑  收藏  举报