ASP.NET调用UpdatePanel的Update()方法实例
本篇内容介绍了“ASP.NET调用UpdatePanel的Update()方法实例”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!

公司主营业务:成都做网站、网站制作、移动网站开发等业务。帮助企业客户真正实现互联网宣传,提高企业的竞争能力。成都创新互联是一支青春激扬、勤奋敬业、活力青春激扬、勤奋敬业、活力澎湃、和谐高效的团队。公司秉承以“开放、自由、严谨、自律”为核心的企业文化,感谢他们对我们的高要求,感谢他们从不同领域给我们带来的挑战,让我们激情的团队有机会用头脑与智慧不断的给客户带来惊喜。成都创新互联推出兖州免费做网站回馈大家。
ASP.NET中用编程的方法控制UpdatePanel的更新
UpdatePanel可以用来创建丰富的局部更新Web应用程序,它是ASP.NET 2.0 AJAX Extensions中很重要的一个控件。对于UpdatePanel,我们也可以使用编程的方法来控制它的更新,可以通过ScriptManager的RegisterAsyncPostBackControl()方法注册一个异步提交的控件,并且调用UpdatePanel的Update()方法来让它更新。再次用我在前面的文章中用到的一个无聊的时间更新例子来看一下,有时候我觉得例子过于复杂更加不好说明白所要讲的内容,如下代码所示,注意Button1并不包含在UpdatePanel中:
<%@PageLanguage="C#"AutoEventWireup="true"CodeFile="Default
.aspx.cs"Inherits="_Default"%>
<scriptrunatscriptrunat="server">
voidButton1_Click(objectsender,EventArgse)
{
this.Label2.Text=DateTime.Now.ToString();
}
script>
<htmlxmlnshtmlxmlns="http://www.w3.org/1999/xhtml">
<headrunatheadrunat="server">
RefreshinganUpdatePanelProgrammaticallytitle>
head>
<formidformid="form1"runat="server">
<asp:ScriptManagerIDasp:ScriptManagerID="ScriptManager1
"runat="server"/>
<asp:UpdatePanelIDasp:UpdatePanelID="UpdatePanel1"runat=
"server"UpdateMode="Conditional">
<asp:LabelIDasp:LabelID="Label1"runat="server"Text=
"更新时间:">asp:Label>
<asp:LabelIDasp:LabelID="Label2"runat="server"Text=
"Label"ForeColor="Red">asp:Label>
ContentTemplate>
asp:UpdatePanel>
<asp:ButtonIDasp:ButtonID="Button1"runat="server"Text=
"Button"OnClick="Button1_Click"/>
div>
form>
body>
html>
再次修改上面的例子,使用ScriptManager的RegisterAsyncPostBackControl()注册Button1为一个异步提交控件,并且调用UpdatePanel的Update()方法:
<%@PageLanguage="C#"AutoEventWireup="true"CodeFile="Default.aspx.cs"
Inherits="_Default"%>
<scriptrunatscriptrunat="server">
voidPage_Load(objectsender,EventArgse)
{
ScriptManager1.RegisterAsyncPostBackControl(Button1);
}
voidButton1_Click(objectsender,EventArgse)
{
this.Label2.Text=DateTime.Now.ToString();
this.UpdatePanel1.Update();
}
script>
<htmlxmlnshtmlxmlns="http://www.w3.org/1999/xhtml">
<headrunatheadrunat="server">
RefreshinganUpdatePanelProgrammaticallytitle>
head>
<formidformid="form1"runat="server">
<asp:ScriptManagerIDasp:ScriptManagerID="ScriptManager1"runat="server"/>
<asp:UpdatePanelIDasp:UpdatePanelID="UpdatePanel1"runat=
"server"UpdateMode="Conditional">
<asp:LabelIDasp:LabelID="Label1"runat="server"Text="更新时间:">asp:Label>
<asp:LabelIDasp:LabelID="Label2"runat="server"Text="Label"ForeColor
="Red">asp:Label>
ContentTemplate>
asp:UpdatePanel>
<asp:ButtonIDasp:ButtonID="Button1"runat="server"Text=
"Button"OnClick="Button1_Click"/>
div>
form>
body>
html>
“ASP.NET调用UpdatePanel的Update()方法实例”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注创新互联网站,小编将为大家输出更多高质量的实用文章!
当前名称:ASP.NET调用UpdatePanel的Update()方法实例
当前路径:
http://www.bluegullmedia.com/article/isjsho.html
基本
文件
流程
错误
SQL
调试
- 请求信息 : 2026-05-19 19:13:04 HTTP/1.1 GET : /article/isjsho.html
- 运行时间 : 0.3357s ( Load:0.0014s Init:0.0007s Exec:0.3226s Template:0.0110s )
- 吞吐率 : 2.98req/s
- 内存开销 : 480.72 kb
- 查询信息 : 12 queries 5 writes
- 文件加载 : 36
- 缓存信息 : 0 gets 0 writes
- 配置加载 : 130
- 会话信息 : SESSION_ID=o7v5b4otepg33scpsp5b9q6lk2
- /home/wwwroot/bluegullmedia/wwwroot/index.php ( 1.09 KB )
- /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/ThinkPHP.php ( 4.61 KB )
- /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Library/Think/Think.class.php ( 12.26 KB )
- /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Library/Think/Storage.class.php ( 1.37 KB )
- /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Library/Think/Storage/Driver/File.class.php ( 3.52 KB )
- /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Mode/common.php ( 2.82 KB )
- /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Common/functions.php ( 53.56 KB )
- /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Library/Think/Hook.class.php ( 4.01 KB )
- /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Library/Think/App.class.php ( 13.49 KB )
- /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Library/Think/Dispatcher.class.php ( 14.79 KB )
- /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Library/Think/Route.class.php ( 13.36 KB )
- /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Library/Think/Controller.class.php ( 11.23 KB )
- /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Library/Think/View.class.php ( 7.59 KB )
- /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Library/Behavior/BuildLiteBehavior.class.php ( 3.68 KB )
- /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Library/Behavior/ParseTemplateBehavior.class.php ( 3.88 KB )
- /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Library/Behavior/ContentReplaceBehavior.class.php ( 1.91 KB )
- /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Conf/convention.php ( 11.15 KB )
- /home/wwwroot/bluegullmedia/wwwroot/App/Common/Conf/config.php ( 2.16 KB )
- /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Lang/zh-cn.php ( 2.55 KB )
- /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Conf/debug.php ( 1.49 KB )
- /home/wwwroot/bluegullmedia/wwwroot/App/Home/Conf/config.php ( 0.31 KB )
- /home/wwwroot/bluegullmedia/wwwroot/App/Home/Common/function.php ( 3.33 KB )
- /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Library/Behavior/ReadHtmlCacheBehavior.class.php ( 5.62 KB )
- /home/wwwroot/bluegullmedia/wwwroot/App/Home/Controller/ArticleController.class.php ( 6.02 KB )
- /home/wwwroot/bluegullmedia/wwwroot/App/Home/Controller/CommController.class.php ( 1.60 KB )
- /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Library/Think/Model.class.php ( 60.11 KB )
- /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Library/Think/Db.class.php ( 32.43 KB )
- /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Library/Think/Db/Driver/Pdo.class.php ( 16.74 KB )
- /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Library/Think/Cache.class.php ( 3.83 KB )
- /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Library/Think/Cache/Driver/File.class.php ( 5.87 KB )
- /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Library/Think/Template.class.php ( 28.16 KB )
- /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Library/Think/Template/TagLib/Cx.class.php ( 22.40 KB )
- /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Library/Think/Template/TagLib.class.php ( 9.16 KB )
- /home/wwwroot/bluegullmedia/wwwroot/App/Runtime/Cache/Home/7540f392f42b28b481b30614275e4e55.php ( 18.20 KB )
- /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Library/Behavior/WriteHtmlCacheBehavior.class.php ( 0.97 KB )
- /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Library/Behavior/ShowPageTraceBehavior.class.php ( 5.24 KB )
- [ app_init ] --START--
- Run Behavior\BuildLiteBehavior [ RunTime:0.000011s ]
- [ app_init ] --END-- [ RunTime:0.000058s ]
- [ app_begin ] --START--
- Run Behavior\ReadHtmlCacheBehavior [ RunTime:0.000075s ]
- [ app_begin ] --END-- [ RunTime:0.000105s ]
- [ view_parse ] --START--
- [ template_filter ] --START--
- Run Behavior\ContentReplaceBehavior [ RunTime:0.000120s ]
- [ template_filter ] --END-- [ RunTime:0.000170s ]
- Run Behavior\ParseTemplateBehavior [ RunTime:0.010092s ]
- [ view_parse ] --END-- [ RunTime:0.010147s ]
- [ view_filter ] --START--
- Run Behavior\WriteHtmlCacheBehavior [ RunTime:0.000089s ]
- [ view_filter ] --END-- [ RunTime:0.000112s ]
- [ app_end ] --START--
- 1064:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') LIMIT 1' at line 1
[ SQL语句 ] : SELECT `id`,`pid`,`navname` FROM `cx_nav` WHERE ( id= ) LIMIT 1
- 1064:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') LIMIT 1' at line 1
[ SQL语句 ] : SELECT `id`,`navname` FROM `cx_nav` WHERE ( id= ) LIMIT 1
- 1064:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1
[ SQL语句 ] : SELECT `id`,`navname` FROM `cx_nav` WHERE ( pid= )
- [8] Undefined index: pid /home/wwwroot/bluegullmedia/wwwroot/App/Home/Controller/ArticleController.class.php 第 47 行.
- [2] mkdir(): Permission denied /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Library/Think/Cache/Driver/File.class.php 第 59 行.
- [2] mkdir(): Permission denied /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Library/Think/Cache/Driver/File.class.php 第 59 行.
- [8] Undefined index: db_host /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Library/Think/Db.class.php 第 120 行.
- [8] Undefined index: db_port /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Library/Think/Db.class.php 第 121 行.
- [8] Undefined index: db_name /home/wwwroot/bluegullmedia/wwwroot/ThinkPHP/Library/Think/Db.class.php 第 122 行.

0.3357s
