1. ScriptManager和UpdatePanel控件联合使用可以实现页面局部异步刷新的效果。UpdatePanel用来设置页面中局部异步刷新的区域,它必须依赖于ScriptManager,因为ScriptManager控件提供了客户端脚本生成与管理UpdatePanel的功能。

ScriptManager属性 解释
EnablePartialRendering 如果启用了部分呈现且禁止了整页更新,则为 true;否则为 false。 默认值为 true。
 
   

一、实例一

UpdatePanel内部控件引起的回发,来异步更新当前UpdatePanel内部其他控件的内容。 
前台代码如下:

    <div id="zcfl" class="field" style="display: none">
<legend class="legend" style="text-align: center;">资产分类</legend>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<table class="tablebody">
<tr>
<td>
<span style="padding-left: 9px;">.选好资产大类 ·····→ .再选择具体分类:</span>
</td>
</tr>
<tr>
<td style="text-align: center; padding: 8px 0px;">
<asp:RadioButtonList ID="ddlDl" runat="server" RepeatDirection="horizontal" CssClass="txt radiobutton"
RepeatLayout="Flow" OnSelectedIndexChanged="ddlDl_SelectedIndexChanged" AutoPostBack="True">
<asp:ListItem Value="" Selected="true">固定资产</asp:ListItem>
<asp:ListItem Value="">无形资产</asp:ListItem>
<asp:ListItem Value="">其他</asp:ListItem>
</asp:RadioButtonList>
</td>
</tr>
<tr>
<td id="ddlzczl" style="text-align: center; padding: 12px 0px;">
<asp:RadioButtonList ID="ddlZcfl" runat="server" RepeatDirection="horizontal" CssClass="txt radiobutton"
RepeatLayout="flow">
</asp:RadioButtonList>
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
</div>

后台代码如下:

protected void ddlDl_SelectedIndexChanged(object sender, EventArgs e)
{
string id = ddlDl.SelectedValue;
switch (id)
{
case "":
GyHelp.BindListN(ddlZcfl, new ZcFlbAction().GetDataBindGdzc(), "text", "value", false, string.Empty, string.Empty); break;
case "":
GyHelp.BindListN(ddlZcfl, new ZcFlbAction().GetDataBindWxzc(), "text", "value", false, string.Empty, string.Empty); break;
default:
GyHelp.BindListN(ddlZcfl, new ZcFlbAction().GetDataBindQtzc(), "text", "value", false, string.Empty, string.Empty);
break;
}
}

注意:
此时ScriptManager的EnablePartialRendering属性应设为true(默认即为true);
UpdatePanel的UpdateMode属性应设为Always(默认即为Always);
UpdatePanel的ChildAsTrigger属性应设为true(默认即为true);

效果如图:

其他使用方法见 链接

最新文章

  1. &lt;五&gt;JDBC_利用反射及JDBC元数据编写通用的查询方法
  2. cloudera manager安装spark后使用spark shell编写基于scala的world count
  3. 烧写AT91Bootstrap不能连接SAM-BA的解决方法
  4. 学一点Git--20分钟git快速上手
  5. tar: Removing leading `/’ from member names
  6. cssText在 IE6/7/8和chrome/Firefox/IE9+的不同
  7. topcoder 643 DIV2
  8. 使用Druid作为数据源
  9. Android ActionBar完全解析,使用官方推荐的最佳导航栏(上)
  10. cocos2d-x中的Tiled地图
  11. PHP转码函数
  12. Tomcat启动失败的解决方法
  13. Windows Azure 自动伸缩已内置
  14. 《C++语言基础》实践參考——数组作数据成员
  15. C++中模板template &lt;typename T&gt;
  16. loj.ac:#10024. 「一本通 1.3 练习 3」质数方阵
  17. nova-api nova-compute 启动服务的时候有的没有加配置文件有的加了
  18. Oracle创建&#39;数据库&#39;三步走
  19. TensorFlow随机值:tf.random_normal函数
  20. django中的转义

热门文章

  1. Redies安装,修配置,设置密码,
  2. 责任链模式-Chain of Responsibility(Java实现), 例2
  3. 腾讯地图 API 调用入门
  4. Nuxt.js笔记
  5. Storage 002 电商数据库设计
  6. jira7.3.6的安装步骤
  7. Flsk-Bootstrap-2
  8. L1-Day5
  9. Java基础——Instanceof 运算符
  10. 一个 戴尔 dell 笔记本 bios Preparing to begin setup 问题