简体   繁体   中英

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.

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?

Try putting the control within an Update Panel.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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