在sharepoint 2013 Web部件中使用Updatepanel [英] Using Updatepanel in sharepoint 2013 web part

查看:71
本文介绍了在sharepoint 2013 Web部件中使用Updatepanel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨专家,

我们在sharepoint 2013中面临与updatepanel相关的问题。我们有一个包含标签和按钮的示例webpart,我们想写一些东西到单击按钮事件中的标签而不刷新整个页面。我们的示例代码如下:

We are facing problem related to updatepanel in sharepoint 2013. we have a sample webpart that includs a label and a button, we want to write somthing to label in click event of button without refreshing the whole page. Our sample code is as followed :

 < asp:UpdatePanel runat =" server" ID =" UpdatePanel1">

  &NBSP; &NBSP; &NBSP; < ContentTemplate>

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; < asp:Label ID =" lbl" RUNAT = QUOT;服务器"文本= QUOT;加载" Visible =" true">< / asp:Label>

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; < asp:Button ID =" btn" RUNAT = QUOT;服务器" OnClick =" btn_Click" />

  &NBSP; &NBSP; &NBSP; < / ContentTemplate>

  &NBSP; &NBSP; &NBSP; <触发器>

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; < asp:AsyncPostBackTrigger ControlID =" btn"事件名称= QUOT;按一下[ />

  &NBSP; &NBSP; &NBSP; < /触发器>

  &NBSP; < / asp:UpdatePanel>

 <asp:UpdatePanel runat="server" ID="UpdatePanel1">
        <ContentTemplate>
            <asp:Label ID="lbl" runat="server" Text="Loaded" Visible="true"></asp:Label>
            <asp:Button ID="btn" runat="server" OnClick="btn_Click"/>
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="btn" EventName="Click" />
        </Triggers>
    </asp:UpdatePanel>

我们已经尝试了这个
链接
 但无法实现我们的目标。

We have tried the solution mentioned on this link but could not achieve our goal.

此问题的任何解决方案以及示例代码都将受到高度赞赏。

Any solution for this problem along with sample code will be highly appreciated.

谢谢。

学习者

推荐答案

您好

您不需要这样:

 <触发器>

     < asp:AsyncPostBackTrigger ControlID =" btn"事件名称= QUOT;按一下[ />
$
 < /触发器>

 <Triggers>
     <asp:AsyncPostBackTrigger ControlID="btn" EventName="Click" />
 </Triggers>

默认情况下,UpdatePanel中的所有子控件都充当触发器,因此您不需要此部件和它将自动完成工作。

all child controls in UpdatePanel by default act as triggers so you don't need this part and it will automatically do the job.


这篇关于在sharepoint 2013 Web部件中使用Updatepanel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆