简体   繁体   中英

Refresh Update Panel c#

I have an update panel that seems to not being refreshed when I click the delete button. I know the row is getting deleted bc if i leave the page and come back then the row is no longer there. Any idea why the update panel is not getting refreshed though?

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

  protected void btnDeleteMessages_Click(object sender, EventArgs e)

{

  DeleteRow();

  UpdatePanel1.Update();

}

If you're using any sort of data-bound controls inside of the update panel, you'll need to call the DataBind() method on each of those controls to see updates to the underlying data reflected on your page.

I suspect that this could be the problem, especially if your DeleteRow() method makes changes to the underlying data, and not to the table itself.

Do you have CausesValidation property set to "True"? If yes, then try making it to false and see. DeleteRow also could be of help.

If not, lets see if this code snippet does the job?

if (ButtonClick!= null)
        {
            Page.GetType().InvokeMember(ButtonClick.Method.Name, BindingFlags.InvokeMethod, null, Page, new []{sender, e});
        }

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