随笔 - 229  文章 - 2  评论 - 511  阅读 - 84万

ATLAS学习---UndatePanel

     <script language="c#">
    protected void Button2_Click(object sender, EventArgs e)
    {

        this.textbox1.Text = DateTime.Now.ToString();
    }
</script>

   <atlas:ScriptManager ID="ScriptManager1" runat="server"   EnablePartialRendering="true"/>
       
        <atlas:UpdatePanel ID="UpdatePanel1" runat="server" Mode="Conditional" RenderMode="inline">
            <Triggers>
                <atlas:ControlEventTrigger  ControlID="Button1" EventName="Click"/></Triggers>
                <ContentTemplate>
                    <asp:TextBox ID="textbox1" runat="server" ></asp:TextBox>
                </ContentTemplate>
        </atlas:UpdatePanel>
       <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="click" />



执行这段程序,点击Button1后,文本框中的内容呈现为当前的时间。
UpdatePanel控件用放置需要更新或改变的控件,
UpdatePanel控件内可包含多个<Triggers>标记,但只能包含一个<ContentTemplate>标记
其中的<Triggers>标记的ControlEventTrigger的ControlID指改变textbox1的控件ID(这里应填写textbox1),EventName应填入控件所触发的事件名,这里的事件名等同于控件本身的事件名称
在<ContentTemplate>内放置要改变的控件。

Mode属性的设置

The Mode property specifies when the UpdatePanel refreshes its contents. If the Mode property is set to Always, the contents of the panel are refreshed during every postback. If the Mode property is set to Conditional, the panel is rendered on the server based on one or more triggers, such as when specified property values change or when specified events occur. This optimizes the markup sent to the client during postback.



 

posted on   stswordman  阅读(366)  评论(0编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列:基于图像分类模型对图像进行分类
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 25岁的心里话
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 按钮权限的设计及实现
< 2006年5月 >
30 1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31 1 2 3
4 5 6 7 8 9 10

点击右上角即可分享
微信分享提示