Avoid page refresh on Auto PostBack using UpdatePanel in ASP.Net

Last Reply 24 days ago By pandeyism

Posted 24 days ago

how to avoid page refresh in asp.net webforms on any event

whether click button, drop down list.

 

Posted 24 days ago

Hi Fato0ma,

If you  want avoid page refresh so use update panel.

If you did't want to use update panel so you need to use jquery ajax call.

Refer below link and code.

Insert Edit Update and Delete in ASP.Net GridView without PostBack in ASP.Net

HTML

<asp:ScriptManager runat="server" />
<asp:UpdatePanel runat="server">
    <ContentTemplate>
        <asp:Button ID="Button1" Text="Submit" runat="server" OnClick="Save" />
        <asp:DropDownList runat="server" AutoPostBack="true" OnSelectedIndexChanged="Changed">
            <asp:ListItem Text="text1" />
            <asp:ListItem Text="text2" />
        </asp:DropDownList>
    </ContentTemplate>
</asp:UpdatePanel>

Code

protected void Save(object sender, EventArgs e)
{
      
}

protected void Changed(object sender, EventArgs e)
{

}