/// <summary>
        /// 定时发送信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnDsfs_Click(object sender, EventArgs e)
        {            aTimers.Interval = 1000;
            aTimers.Elapsed += new ElapsedEventHandler(TimeEvent);
            aTimers.Enabled = true;
        }        delegate string A();
        private void TimeEvent(object source, ElapsedEventArgs e)
        {
            int i = YBpoll();
            if (i == 0)
            {
                txtList.Text = "aaa";
            }
            else
            {            }
        }C/S能取到txtList.text的值,web的怎么取?
C/s可以通过textBox1.Invoke(setMessage, i.ToString());
Invoke()这个能取出来。
Invoke()在B/S里用不了

解决方案 »

  1.   

    web页面有生存周期,要么写在后台执行,web里最好用js实现
      

  2.   

    ajax定时器取不到值呢,不知道怎么回事 protected void Timer1_Tick(object sender, EventArgs e)
            {
                int count = Convert.ToInt32(this.Label2.Text);
                count++;
                this.Label2.Text = count.ToString();
                           int i = YBpoll();
                Label3.Text = i.ToString();
    label3.text=i.tostring()就是返回不了值