Articles → ASP .NET AJAX → Updatemode Property Of Updatepanel Control In Asp.Net Ajax
Updatemode Property Of Updatepanel Control In Asp.Net Ajax
Syntax
<asp:UpdatePanel ID=" "
UpdateMode=" "
runat="server"></asp:UpdatePanel>
- Always – Update panel is updated on every post back raised from anywhere on the page.
- Conditional – Update panel is updated when post back is raised from the control in the same update panel.
Example
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<!DOCTYPE html>
<html
xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager"
runat="server" />
<asp:UpdatePanel ID="UpdatePanel1"
UpdateMode="Always"
runat="server">
<ContentTemplate>
<fieldset>
<legend>UpdatePanel content</legend><%=DateTime.Now.ToString() %>
<br />
<asp:Button ID="Button1"
Text="Refresh Panel"
runat="server" />
</fieldset>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel ID="UpdatePanel2"
UpdateMode="Conditional"
runat="server">
<ContentTemplate>
<fieldset>
<legend>UpdatePanel content</legend><%=DateTime.Now.ToString() %>
<br />
<asp:Button ID="Button2"
Text="Refresh Panel"
runat="server" />
</fieldset>
</ContentTemplate>
</asp:UpdatePanel>
</form>
</body>
</html>
Output
Click to Enlarge