Follow in Twitter & Facebook

Like in Facebook

Powered By Blogger Widgets

Free Download

FREE Tools

Tuesday, August 28, 2012 updatepanel refresh page

In this article we will discuss how we can refresh a page from a button click inside a updatepanel. Also you can check my last article on Ajax Progress bar in Asp.Net.

As I have explained in my last article on Ajax updatepanel example in, button click will not do postback. Suppose there are 2 buttons, in 1 button I want to do postback, remember since the button is inside the UpdatePanel so it will not do postback. We can do postback by using asp:PostBackTrigger control.
Below is the HTML code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
html xmlns=""><
head runat="server"><title></title></
body><form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server"><ContentTemplate>
<asp:Button ID="btnAjaxNoRefresh" runat="server" Text="Click for no refresh !" OnClick="btnAjaxNoRefresh_Click" />
<br />
<asp:Button ID="btnDoPostBack" runat="server" Text="Click for Postback !" OnClick="btnDoPostBack_Click" />
<Triggers><asp:PostBackTrigger ControlID="btnDoPostBack" /></Triggers>
ControlID: ID of the button on which we need postback.

0 on: " updatepanel refresh page"