62,046
社区成员
发帖
与我相关
我的任务
分享
protected Timer AutoSave = new Timer();//新建定时器
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
AutoSave.Elapsed += new ElapsedEventHandler(OnTimedEvent);//定时事件
AutoSave.Interval = 9000;//定时15分钟
AutoSave.Enabled = true;
AutoSave.AutoReset = true;
}
}
private void OnTimedEvent(object source, ElapsedEventArgs e)
{
string str = TextBox1.Text;//在这里获取不到TextBox1的值!
}
<asp:Timer ID="Timer1" runat="server" Interval="9000" ontick="Timer1_Tick">
</asp:Timer>
<asp:Timer ID="Timer1" runat="server" Interval="9000" ontick="Timer1_Tick">
</asp:Timer>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
protected void Timer1_Tick(object sender, EventArgs e)
{
string str = TextBox1.Text;//在这里获取不到TextBox1的值!
}