0

我正在使用 updatepanel 作为链接按钮,这样它就不会刷新整个页面。单击该链接按钮时,我需要在多视图控件中设置一个活动视图,该控件在没有更新面板的情况下可以正常工作。但是当我使用更新面板时它不起作用。你能帮我怎么做吗

更新面板代码

  <asp:UpdatePanel ID="UpdatePanel3" runat="server">
    <ContentTemplate>
    <asp:LinkButton ID="changephoto" runat="server" ForeColor="Blue" OnClick="changephoto_Click">Change Photo</asp:LinkButton><br /><br />
    </ContentTemplate>
    <Triggers>
            <asp:AsyncPostBackTrigger ControlID="changephoto" EventName="Click" />
    </Triggers>
   </asp:UpdatePanel>

点击事件

               Protected Sub changephoto_Click(ByVal sender As Object, ByVal e As System.EventArgs)
    MultiView_Updates.SetActiveView(View_ChangePhoto)
    'bindprofileimage()
End Sub
4

2 回答 2

1

将多视图放在更新面板中.....

于 2012-06-11T13:51:49.477 回答
1

如果您想在点击更新面板内的链接按钮时设置视图,那么您的多视图也必须存在于更新面板内。否则,控件将不会被刷新。

UpdatePanel 控件通过指定无需刷新整个页面即可更新的页面区域来工作。异步回发的行为类似于常规回发,因为生成的服务器页面执行完整的页面和控件生命周期。但是,对于异步回发,页面更新仅限于页面区域,这些区域包含在 UpdatePanel 控件中并标记为要更新。服务器仅将受影响元素的 HTML 标记发送到浏览器。

使用嵌套的 UpdatePanel 控件

UpdatePanel 控件可以嵌套。如果父面板被刷新,所有嵌套面板也会被刷新。

The following example shows markup that defines an UpdatePanel control inside another UpdatePanel control. A button in the parent panel triggers an update of the content in both the parent and the child panel. The button in the child panel triggers an update of only the child panel.

于 2012-06-11T14:12:34.897 回答