Follow in Twitter & Facebook


Like in Facebook

Powered By Blogger Widgets

Free Download

FREE Tools


Monday, August 27, 2012

Ajax updatepanel example in asp.net

In this article we will discuss about how to use updatepanel in asp.net. Also you can check  my last article on Ajax Progress bar in Asp.Net. Also you can see some Ado.Net and SharePoint 2010 articles.

Normally we use updatepanel for partial page refreshing, means the code within that panel will not postback. Microsoft provides AJAX which helps us in doing so.

For this our .aspx page should contain one ScriptManager and can contain more than one updatepanel control. The code that we put inside the updatepanel will not do postback on click event. UpdatePanel and
 ScriptManager are available in Toolbax under AJAX Extensions section.

Remember we need to put the scriptmanager control inside the form tag.

Below is the full HTML code:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="AjaxUpdatePanel.aspx.cs"
Inherits="AjaxUpdatePanel" %>

<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Ajax updatepanel example in asp.net</title>
</head>
<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" />

</ContentTemplate>
</asp:UpdatePanel>
<div>
</div>
</form>
</body>
</html>




0 on: "Ajax updatepanel example in asp.net"