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

Last Reply 7 months ago By pandeyism

Posted 7 months ago

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

whether click button, drop down list.

 

You are viewing reply posted by: pandeyism 7 months ago.
Posted 7 months 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)
{

}