那你至少在Page_Load里调用了那个函数了吗?
解决方案 »
- dropdownlist与repeater联动分页出问题
- tipswindown弹窗插件遇到$.ajax({});远程调用时会一直处于加载状态的问题
- .NET 如何动态添加TextBox 并在后台取得这些添加的控件ID
- 为什么网站要登陆两次才能进入
- 在VS2005上演练MSDN里的用户登录那一节,运行后输入用户名和密码提交后报错,为什么?
- 高分求如何以流方式输出图片!
- asp.net做的网站出现这样一个错误,请教各位大虾
- Gridview更新问题!
- 求助,谁有向日历添加事件的代码,谢谢(能够实现Daily Weekly Monthly )view
- 终于可以放200了,因为朋友找工作没稳定下了,而且年前房子也没租好,心情不爽[散分]--另外感谢这段时间对我帮助的朋友,祝大家新年快乐
- AJax的问题
- 这个母版页显示问题真希奇,古怪,难道是BUG?
但是页面就是没有显示~~不知道怎么回事!!
单步执行看到TextBox的值是改变的,但是页面没有显示~~~
{
protected System.Web.UI.WebControls.TextBox txtTest;
protected System.Web.UI.WebControls.TextBox txt;
protected System.Web.UI.WebControls.TextBox TextBox1;
protected System.Web.UI.WebControls.TextBox TextBox2;
protected EeekSoft.Web.PopupWin PopupWin1;
protected EeekSoft.Web.PopupWinAnchor PopupWinAnchor1;
protected System.Timers.Timer t;
private void Page_Load(object sender, System.EventArgs e)
{
if(!Page.IsPostBack)
{
t = new System.Timers.Timer(3000);//实例化Timer类,设置间隔时间为10000毫秒;
t.Elapsed += new System.Timers.ElapsedEventHandler(show);
t.AutoReset = true;
t.Enabled = true;
}
} public void show(object source, System.Timers.ElapsedEventArgs e)
{
SqlConnection conn = new SqlConnection("server=JSJ-005;database=remind;uid=sa");
string a = "wowo";
string str = "select * from remind1 where name='"+a.ToString()+"'";
SqlCommand cmd = new SqlCommand(str,conn);
if(conn.State.ToString()=="Closed")
{
conn.Open();
}
SqlDataReader dr = cmd.ExecuteReader();
if(dr.Read())
{
//if(dr.IsDBNull(2).ToString()!=null)
//{
//this.TextBox1.Text = dr.GetValue(2).ToString();
//}
this.TextBox1.Text = dr.IsDBNull(2)? null :dr.GetValue(2).ToString(); if(TextBox1.Text.ToString()!="")
{
PopupWinAnchor1.NewMessage = "afjsdlf";
//PopupWin1.Message = PopupWinAnchor1.NewMessage.ToString();
PopupWinAnchor1.NewText = "fffffffffff";
//PopupWin1.Text=PopupWinAnchor1.NewText.ToString();
PopupWinAnchor1.NewTitle = "aaaaaaaaaaa";
//PopupWin1.Title=PopupWinAnchor1.NewTitle.ToString();
PopupWin1.Visible = true;
PopupWin1.AutoShow = false; }
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
System.Timers.Timer t = new System.Timers.Timer(10000);
t.Elapsed+=new System.Timers.ElapsedEventHandler(theout);
t.AutoReset = true;
t.Enabled = true;
}
public void theout(object source, System.Timers.ElapsedEventArgs e)
{
MessageBox.Show("ok");
}
}
}在WEB中一般是在Global.asax中定义System.Timers.Timer对象:
Global.asax:
void Application_Start(object sender, EventArgs e)
{
System.Timers.Timer timer = new System.Timers.Timer();
timer.Interval = 1000;
timer.Elapsed += new System.Timers.ElapsedEventHandler(timer_Elapsed);
timer.Start();
}
void timer_Elapsed(object source, ElapsedEventArgs e)
{
Application.Lock();
Application["a"] = "hehe:" + DateTime.Now.ToString("mm:ss");
Application.UnLock();
}
比如怎么能看到定时的结果,即怎么进行测试呢??
vs05:
建一个Ajax Enabled Web Site,这时已经有个ScriptManager在页面里了,拖一个UpdatePanel,然后拖一个Timer放到UpdatePanel里,设置Interval属性为1000(1秒),再放一个Label1,双击Timer,在Timer1_Tick处理方法里:
Label1.Text = DateTime.Now.ToString();
ps:定时实现参考:http://hi.baidu.com/tryboy27/blog/item/6c413bef3e03b0ebcf1b3e7e.html
ps:定时实现参考:http://hi.baidu.com/tryboy27/blog/item/6c413bef3e03b0ebcf1b3e7e.html
ps:定时实现参考:http://hi.baidu.com/tryboy27/blog/item/6c413bef3e03b0ebcf1b3e7e.html
实在不行我就考虑用Socket通信来解决了~~将服务器端改变的值传回给客户端~~不知道这样行不行~~
Socket也不会啊~~晕啊~~开始学习Socket~~看看能不能行吧~~
先谢谢大家了