蜘蛛网博客

.net学习笔记

导航

UpdatePanel 和 ScriptManage

可以仅有 ScriptManage,而没有UpdatePanel,通过bind方法实现部分更新。
使用UpdatePanel结合ScriptManage可以不用写一句代码实现部分更新。(更新的部分要用UpdatePanel包括起来。下面就是例子:

<%@ Page Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        Label1.Text = TextBox1.Text
    End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>无标题页</title>
</head>
<body><atlas:ScriptManager ID="scr1" runat="server" EnablePartialRendering=true></atlas:ScriptManager>
    <form id="form1" runat="server">
    <div>
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
        <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />&nbsp;
        <atlas:UpdatePanel ID="Updatepanel1" runat="server">
            <ContentTemplate>
        <asp:Label ID="Label1" runat="server" Text="Label" Width="148px"></asp:Label>hjhjk
            </ContentTemplate>
            <Triggers>
                <atlas:ControlEventTrigger ControlID="Button1" EventName="Click" />
            </Triggers>
        </atlas:UpdatePanel>
        &nbsp; hjhjhkjhjhjkkj</div>
    </form>
</body>
</html>

posted on 2006-08-20 18:08  spiderNet  阅读(685)  评论(2)    收藏  举报