简体   繁体   English

绑定数据仅刷新控件,而不刷新整个页面

[英]Databind to refresh only a control, not a whole page

It appears that calling Control.DataBind() in C#/ASP refreshes the whole page, and brings the user back to the top of the page. 似乎在C#/ ASP中调用Control.DataBind()刷新整个页面,并将用户带回到页面顶部。

Is there a way to call DataBind() and have it only refresh the control it's affecting, leaving the user at the same spot on the page after the databind? 有没有一种方法可以调用DataBind()并使其仅刷新其影响的控件,从而使用户在数据绑定后位于页面的同一位置?

Try putting the control within an Update Panel. 尝试将控件放在“更新面板”中。

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>    
        <control goes here>
    </ContentTemplate>    
</updatePanel>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM