日期:2014-05-19  浏览次数:20466 次

Ajax的基础问题!
时钟控件介绍
这次你将使用Microsoft   ASP.NET   2.0   AJAX   Extensions服务器控件:ScriptManager、UpdatePanel、Timer来更新页面中的一部分。添加这些控件到一个页面上限制每次回调便更新整个页面。只有UpdatePanel控件内容将会被更新。
1.创建一新页面,转到设计视图
2.如果页面没有ScriptManager控件,就在AJAX   Extensions工具箱面板上双击它添加到页面上
3.加入UpdatePanel控件
4.单击UpdatePanel控件内部,再双击Timer控件添加到UpdatePanel控件上(timer要放在UpdatePanel内部)
5.设置Timer控件Interval属性为10000(10秒)
6.拖入一个标准Label到UpdatePanel控件上
7.设置Label的Text属性为“Panel   not   refreshed   yet.”
8.拖放第二个Label到UpdatePanel控件外面
9.设置Timer控件的Tick事件
10.设置Page_Load事件
代码如下:
        protected   void   Page_Load(object   sender,   EventArgs   e)
        {
                Label2.Text   =   "Page   created   at:   "   +
                    DateTime.Now.ToLongTimeString();
        }
        protected   void   Timer1_Tick(object   sender,   EventArgs   e)
        {
                Label1.Text   =   "Panel   refreshed   at:   "   +
                    DateTime.Now.ToLongTimeString();
        }
运行

怎么老是报: "Sys "未定义呀?

应该怎么设置呀?

------解决方案--------------------
system.web.extensions有没有引用
web.config配置的正确否
实在找不到原因的话,用ide新建一个ajax enabled web site
------解决方案--------------------
是的,是web.config的配置问题。

由于需要增加的东西比较多,你可以自己新建一个ajax enabled web site项目,或者打开别的ajax项目,把其中的web.config文件拷贝过来。