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>




  1. Always – Update panel is updated on every post back raised from anywhere on the page.
  2. 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


Picture showing the output of UpdateMode Property of UpdatePanel control in asp.net ajax
Click to Enlarge


Posted By  -  Karan Gupta
 
Posted On  -  Friday, August 31, 2018

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250