Wednesday, 26 December 2012

SharePoint 2010

Hi to my dear viewers

With in soon i will be post Sharepoint 2010 Material in easy steps to develop

wait for some time

Yours Hanumantha Rao.Nagula

Sunday, 9 December 2012

Ajax Tutorial

Ajax : TimerControl


4 Timer Control
Timer control performs postbacks at the defined intervals. This is generally used to update the content of UpdatePanel at a defined interval. Apart from this it can be used to post the whole page at defined interval.
There are few properties that are used more frequetly, these are
Interval
Gets or sets the time interval in milliseconds after OnTick event of Timer control will fire.
OnTick
Used to specifiy the method name that will after specified time interval.
Timer control can be used in two ways.
DEMO : Timer Control
1. Inside an UpdatePanel control
When the timer control is used inside an
UpdatePanel control, the Timer control automatically works as a trigger for
the UpdatePanel control, however we can override this behavior by setting the ChildrenAsTriggers property of UpdatePanel as false.
In this case lets say server takes 7 seconds to process the request then following message
will change after every 12 (5+7) seconds as I have specified Timer interval property as 5000 milliseconds (5 seconds).
Following message will change after every 5 seconds
634804680362449375 - Timer control from inside UpdatePanel ticked
<asp:UpdatePanel runat="server" ID="UpdatePanel1" UpdateMode="Conditional">
    <ContentTemplate>
        <asp:Label runat="Server" ID="lblMessage1" Text="Please wait ..." SkinID="FormValueMessage" />
        // Timer control inside UpdatePanel
        <asp:Timer runat="Server" ID="Timer1" OnTick="Timer1_Tick" Interval="5000" />
    </ContentTemplate>   
</asp:UpdatePanel>
2. Timer Control Outside UpdatePanel
When the Timer control is outside an UpdatePanel control, we must explicitely define the Timer control as trigger for the UpdatePanel control to be updated.
 In this case Timer, Timer OnTick event will fire after every 3 seconds irrespective of how many seconds server takes to process the request as I have specified Interval as 3000 Milliseconds.
Following message will change after every 3 seconds
634804680373777500 - Timer control from outside UpdatePanel ticked
<asp:UpdatePanel runat="server" ID="UpdatePanel2" UpdateMode="Conditional">
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="Timer2" EventName="Tick" />
    </Triggers>
    <ContentTemplate>
        <asp:Label runat="Server" ID="lblMessage2" SkinID="FormValueMessage" />
    </ContentTemplate>   
</asp:UpdatePanel>
// Timer control outside UpdatePanel
<asp:Timer runat="Server" ID="Timer2" OnTick="Timer2_Tick" Interval="3000" />
Source code                        timer.aspx
<asp:Content ID="Content1" ContentPlaceHolderID="PlaceHolderHeader" Runat="Server">
</asp:Content>
<asp:Content ID="Content2"ContentPlaceHolderID="PlaceHolderForTitleAndIntro" Runat="Server">
<div class="ArticleTitle"><h1>Timer Control</h1></div>
<div class="ArticleContents">Timer control performs postbacks at the defined intervals. This is generally used to update the content of UpdatePanel at a defined interval. Apart from this it can be used to post the whole page at defined interval. </div></asp:Content>
<asp:Content ID="Content3"ContentPlaceHolderID="PlaceHolderForContents"Runat="Server">
There are few properties that are used more frequetly, these are <br /><br />
<table width="100%" class="TutoPropPlaceHolder" border="1" cellpadding="2" cellspacing="1">
<tr>    <td class="DemoCP">Interval</td>
    <td>Gets or sets the time interval in milliseconds after OnTick event of Timer control will fire. </td>
</tr><tr>   <td class="DemoCP">OnTick</td>
    <td> Used to specifiy the method name that will after specified time interval.    </td></tr>
</table><br /><br />
<div class="ArticleContents">
Timer control can be used in two ways.<br /><br />
<!-- START - Demo Section -->
<table class="DemoPlaceHolder" border="1" cellpadding="2" cellspacing="4">
    <tr>  <td class="DemoTitle">      DEMO : Timer Control        </td>
        <td align="right"> <a class="DemoShowSource" href="../../misc/codeviewer/default.aspx?pagename=~/tutorials/ajax/timer.aspx" target="_blank">Show Source Code</a>   </td>    </tr>
    <tr> 
 <td>
        <b>1. Inside an UpdatePanel control</b><br />
When the timer control is used inside an <a href="UpdatePanel.aspx">UpdatePanel</a> control, the Timer control automatically works as a trigger for <br />the UpdatePanel control, however we can override this behavior by setting the ChildrenAsTriggers property of UpdatePanel as false.
        <br /><br />In this case lets say server takes 7 seconds to process the request then following message <br />will change after every 12 (5+7) seconds as I have specified Timer interval property as 5000 milliseconds (5 seconds).        <br /><br />
        Following message will change after every 5 seconds<br />
        <asp:UpdatePanel runat="server" ID="UpdatePanel1" UpdateMode="Conditional">
        <ContentTemplate>            <br />
            <asp:Label runat="Server" ID="lblMessage1" Text="Please wait Timer Control from inside UpdatePanel will fire in 5 seconds" ForeColor="Green" />
            <asp:Timer runat="Server" ID="Timer1" OnTick="Timer1_Tick" Interval="5000" />
        </ContentTemplate>   
    </asp:UpdatePanel>
<pre>&lt;asp:UpdatePanel runat="server" ID="UpdatePanel1" UpdateMode="Conditional"&gt;
    &lt;ContentTemplate&gt;        &lt;asp:Label runat="Server" ID="lblMessage1" Text="Please wait ..." SkinID="FormValueMessage" /&gt;
        // Timer control inside UpdatePanel
        &lt;asp:Timer runat="Server" ID="Timer1" OnTick="Timer1_Tick" Interval="5000" /&gt;
    &lt;/ContentTemplate&gt;      &lt;/asp:UpdatePanel&gt;</pre>          </td>
        <td><a href="../../userfiles/samples/dotnetfundaaspajax.zip">Download Sample project with Source Code</a></td>     </tr>
        <tr>         <td><b>2. Timer Control Outside UpdatePanel</b><br />
        When the Timer control is outside an UpdatePanel control, we must explicitely define the Timer control as trigger <br />for the UpdatePanel control to be updated.
        <br /><br />In this case Timer, Timer OnTick event will fire after every 3 seconds irrespective of<br /> how many seconds server takes to process the request as I have specified Interval as 3000 milliseconds.    <br /><br />
      Following message will change after every 3 seconds<br />
      <asp:UpdatePanel runat="server" ID="UpdatePanel2" UpdateMode="Conditional">
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="Timer2" EventName="Tick" />
        </Triggers>
        <ContentTemplate>    <br />   <asp:Label runat="Server"  ID="lblMessage2" Text=   "Please wait Timer Control from outside UpdatePanel will fire in 3 seconds" ForeColor="Blue" />
        </ContentTemplate>   
    </asp:UpdatePanel>   
    <asp:Timer runat="Server" ID="Timer2" OnTick="Timer2_Tick" Interval="3000" />   
<pre>&lt;asp:UpdatePanel runat="server" ID="UpdatePanel2" UpdateMode="Conditional"&gt;
    &lt;Triggers&gt;   &lt;asp:AsyncPostBackTrigger ControlID="Timer2" EventName="Tick" /&gt;
    &lt;/Triggers&gt;     &lt;ContentTemplate&gt;
        &lt;asp:Label runat="Server" ID="lblMessage2" SkinID="FormValueMessage" /&gt;
    &lt;/ContentTemplate&gt;     &lt;/asp:UpdatePanel&gt;
// Timer control outside UpdatePanel &lt; asp:Timer runat="Server" ID="Timer2"  OnTick="Timer2_Tick"  Interval="3000" /&gt;</pre>      </td>
        <td><a href="../../userfiles/samples/dotnetfundaaspajax.zip">Download Sample project with Source Code</a></td>     </tr> </table>     </div>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="PlaceHolderFooter" Runat="Server">
</asp:Content>

Timer.aspx.cs
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class tutorials_Ajax_timer : System.Web.UI.Page         {
    protected void Page_Load(object sender, EventArgs e)            {
        try                   {
            impFunctions.WriteMetaTags(this, "timer, asp:timer, timer tutorials, online timer control tutorials", "Free online ASP.NET Ajax Timer control tutorials with live demo, source code and downloadable sample project.", false);
            Label lblSiteMap = (Label)this.Master.FindControl("lblSiteMap");
            lblSiteMap.Text = "<a href=\"/default.aspx\" class=\"siteMap\">Home</a> > <a href=\"/tutorials/\" class=\"siteMap\" title=\"Tutorials Home\">Tutorials</a> > <a href=\"/tutorials/ajax\" class=\"siteMap\">ASP.NET AJAX Tutorials</a> > Timer Control ";                    }
        catch { }     }
    /// <summary>
    /// Fires when Timer Control from inside UpdatePanel ticks
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Timer1_Tick(object sender, EventArgs e)        {
        lblMessage1.Text = "<b>" + DateTime.Now.Ticks + "</b> - Timer control from inside UpdatePanel ticked";                                       }
    /// <summary>
    /// Fires when Timer control of outside panel ticks
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Timer2_Tick(object sender, EventArgs e)        {
        lblMessage2.Text = "<b>" + DateTime.Now.Ticks + "</b> - Timer control from outside UpdatePanel ticked";             }
}

Ajax: UpdateProgress Control


3 UpdateProgress Control
The UpdateProgress control enables us to provide feedback about the progress of the partial page rendering. Please note that for initial page rendering, UpdateProgress control content is not displayed. UpdateProgress control is not an independent control it must be associated with an UpdatePanel control.
            A page con contain multiple UpdateProgress controls provided it has been associated with different UpdatePanel control. To associate UpdateProgress control we need to set AssociatedUpdatePanelID property to any of the UpdatePanel id. If any postback event occurs from inside an UpdatePanel control, its associated UpdateProgress control content if any are displayed.

AssociatedUpdatePanelID
Gets or sets the ID of the UpdatePanel control from which it is associated with.
AssociatedUpdatePanelID
Gets or sets the ID of the UpdatePanel control from which it is associated with.
ClientID
Gets the server control identifier generated by ASP.NET
ClientID
Gets the server control identifier generated by ASP.NET
DisplayAfter
Gets or sets a value in milliseconds before the UpdateProgress control is displayed.
ClientID
Gets the server control identifier generated by ASP.NET
ProgressTemplate
Gets or sets the template that defines the content of the UpdateProgress control.

DEMO : UpdateProgress
Name
Address
Phone
City
Notice "Please wait" message below after clicking button.
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
    <ContentTemplate>
   <asp:Label ID="lblMessage" runat="server" EnableViewState="false" ForeColor="blue"> </asp:Label>
<table border="1">
    <tr>        <td>Name</td>
        <td><asp:TextBox ID="TextBox1" runat="Server"></asp:TextBox>
        <asp:RequiredFieldValidator ID="Req1" runat="server" ControlToValidate="TextBox1" Text=" * Required"></asp:RequiredFieldValidator>            </td>      </tr>
    <tr>          <td>Address</td>
        <td><asp:TextBox ID="TextBox2" runat="Server"></asp:TextBox>
        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox2" Text=" * Required"></asp:RequiredFieldValidator>  </td>      </tr>
    <tr>         <td>Phone</td>
        <td><asp:TextBox ID="TextBox3" runat="Server"></asp:TextBox>
        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate= "TextBox3" Text=" * Required"></asp:RequiredFieldValidator>      </td>     </tr>
    <tr>         <td>City</td>
        <td><asp:TextBox ID="TextBox4" runat="Server"></asp:TextBox>
        <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate= "TextBox4" Text=" * Required"></asp:RequiredFieldValidator>     </td>      </tr>
    <tr>    <td><b>Notice "Please wait" message below after clicking button.</b></td>
  <td><asp:Button ID="btnSave" runat="Server" OnClick="AddRecords" Text="Add Records" /></td>
    </tr>  </table>
</ContentTemplate>
</asp:UpdatePanel>
// UpdateProgress control
<asp:UpdateProgress ID="Up1" runat="Server" AssociatedUpdatePanelID="UpdatePanel1">
    <ProgressTemplate>
        <span style="background-color:Yellow;"><img src="/images/wait.gif" alt="Please wait" />
                 Please wait ...</span>
    </ProgressTemplate>
</asp:UpdateProgress>

Source code
<asp:Content ID="Content1" ContentPlaceHolderID="PlaceHolderHeader" Runat="Server">
</asp:Content>
<asp:Content ID="Content2"ContentPlaceHolderID="PlaceHolderForTitleAndIntro" Runat="Server"><div class="ArticleTitle"><h1>UpdateProgress Control</h1></div>
<div class="ArticleContents">The UpdateProgress control enables us to provide feedback about the progress of the partial page rendering. Please note that for initial page rendering, UpdateProgress control content is not displayed.UpdateProgress control is not an independent control it must be associated with an UpdatePanel control.</div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="PlaceHolderForContents" Runat="Server">
<br />   <div class="ArticleContents">
A page con contain multiple UpdateProgress controls provided it has been associated with different <a href="updatepanel.aspx">UpdatePanel</a> control. To associate UpdateProgress control we need to set AssociatedUpdatePanelID property to any of the UpdatePanel id. If any postback event occurs from inside an UpdatePanel control, its associated UpdateProgress control content if any are displayed.
</div><br />
<table width="100%" class="TutoPropPlaceHolder" border="1" cellpadding="2" cellspacing="1">
<tr>     <td class="DemoCP">AssociatedUpdatePanelID</td>
    <td>    Gets or sets the ID of the UpdatePanel control from which it is associated with. </td> </tr>
<tr>    <td class="DemoCP">AssociatedUpdatePanelID</td>
    <td> Gets or sets the ID of the UpdatePanel control from which it is associated with. </td></tr>
<tr>    <td class="DemoCP">ClientID</td>
    <td>  Gets the server control identifier generated by ASP.NET  </td></tr>
<tr>      <td class="DemoCP">ClientID</td>
    <td>  Gets the server control identifier generated by ASP.NET    </td></tr>
<tr>    <td class="DemoCP">DisplayAfter</td>
    <td>Gets or sets a value in milliseconds before the UpdateProgress control is displayed. </td></tr>
<tr>    <td class="DemoCP">ClientID</td>
    <td>  Gets the server control identifier generated by ASP.NET    </td></tr>
<tr>    <td class="DemoCP">ProgressTemplate</td>
    <td> Gets or sets the template that defines the content of the UpdateProgress control.  </td></tr>
</table>
<!-- START - Demo Section -->
<table class="DemoPlaceHolder" border="1" cellpadding="2" cellspacing="4">
    <tr>   <td class="DemoTitle">       DEMO : UpdateProgress     </td>
        <td align="right"><a class="DemoShowSource" href="../../misc/codeviewer/default.aspx?pagename=~/tutorials/ajax/updateprogress.aspx" target="_blank">Show Source Code</a>  </td>    </tr>
    <tr> <td>  <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
 <asp:Label ID="lblMsg" runat="server" EnableViewState="false" ForeColor="blue"></asp:Label>
        <table border="1">
            <tr>     <td>Name</td>
                <td><asp:TextBox ID="TextBox1" runat="Server"></asp:TextBox>
                <asp:RequiredFieldValidator ID="Req1" runat="server" ControlToValidate="TextBox1" Text=" * Required"></asp:RequiredFieldValidator>            </td>            </tr>
            <tr>                <td>Address</td>
                <td><asp:TextBox ID="TextBox2" runat="Server"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox2" Text=" * Required"></asp:RequiredFieldValidator>             </td>            </tr>
            <tr>              <td>Phone</td>
                <td><asp:TextBox ID="TextBox3" runat="Server"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="TextBox3" Text=" * Required"></asp:RequiredFieldValidator>             </td>            </tr>
            <tr>                <td>City</td>
                <td><asp:TextBox ID="TextBox4" runat="Server"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="TextBox4" Text=" * Required"></asp:RequiredFieldValidator>        </td>        </tr>
            <tr>          <td><b>Notice "Please wait" message below after clicking button.</b></td>
    <td> <asp:Button ID="btnSave" runat="Server" OnClick="AddRecords" Text="Add Records" />
                </td>          </tr>        </table>
        </ContentTemplate>
        </asp:UpdatePanel>
        <asp:UpdateProgress ID="Up1" runat="Server" AssociatedUpdatePanelID="UpdatePanel1">
            <ProgressTemplate>
                <span style="background-color:Yellow;"><img src="/images/wait.gif" alt= "Please wait" />  Please wait ...</span>       </ProgressTemplate>
        </asp:UpdateProgress>         </td>
        <td>           <a href="../../userfiles/samples/dotnetfundaaspajax.zip">Download Sample project with Source Code</a>        </td>    </tr>
    <tr>        <td colspan="2"><pre>
&lt;asp:UpdatePanel <b>ID="UpdatePanel1"</b> runat="server" UpdateMode="Conditional"&gt;
    &lt;ContentTemplate&gt;    &lt;asp:Label ID="lblMessage" runat="server" EnableViewState="false" ForeColor="blue"&gt;&lt;/asp:Label&gt;   &lt;table border="1"&gt;
    &lt;tr&gt;          &lt;td&gt;Name&lt;/td&gt;
        &lt;td&gt;&lt;asp:TextBox ID="TextBox1" runat="Server"&gt;&lt;/asp:TextBox&gt;
        &lt;asp:RequiredFieldValidator ID="Req1" runat="server" ControlToValidate="TextBox1" Text=" * Required"&gt;&lt;/asp:RequiredFieldValidator&gt;
        &lt;/td&gt;                         &lt;/tr&gt;                             &lt;tr&gt;
        &lt;td&gt;Address&lt;/td&gt;
        &lt;td&gt;&lt;asp:TextBox ID="TextBox2" runat="Server"&gt;&lt;/asp:TextBox&gt;
        &lt;asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox2" Text=" * Required"&gt;&lt;/asp:RequiredFieldValidator&gt;
        &lt;/td&gt;                         &lt;/tr&gt;                 &lt;tr&gt;                       &lt;td&gt;Phone&lt;/td&gt;
        &lt;td&gt;&lt;asp:TextBox ID="TextBox3" runat="Server"&gt;&lt;/asp:TextBox&gt;
        &lt;asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="TextBox3" Text=" * Required"&gt;&lt;/asp:RequiredFieldValidator&gt;
        &lt;/td&gt;                         &lt;/tr&gt;                             &lt;tr&gt;                &lt;td&gt;City&lt;/td&gt;
        &lt;td&gt;&lt;asp:TextBox ID="TextBox4" runat="Server"&gt;&lt;/asp:TextBox&gt;
        &lt;asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="TextBox4" Text=" * Required"&gt;&lt;/asp:RequiredFieldValidator&gt;
        &lt;/td&gt;                         &lt;/tr&gt;                 &lt;tr&gt;
    &lt;td&gt;&lt;b&gt;Notice "Please wait" message below after clicking button.&lt;/b&gt;&lt;/td&gt;
        &lt;td&gt;
      &lt;asp:Button ID="btnSave" runat="Server" OnClick="AddRecords" Text="Add Records" /&gt;
      &lt;/td&gt;                           &lt;/tr&gt;             &lt;/table&gt;           &lt;/ContentTemplate&gt;
&lt;/asp:UpdatePanel&gt;
<b>// UpdateProgress control </b>
&lt;asp:UpdateProgress ID="Up1" runat="Server" <b>AssociatedUpdatePanelID="UpdatePanel1"</b>&gt;      &lt;ProgressTemplate&gt;         &lt;span style="background-color:Yellow;"&gt;&lt;img src="/images/wait.gif" alt="Please wait" /&gt; Please wait ...&lt;/span&gt;
    &lt;/ProgressTemplate&gt;                     &lt;/asp:UpdateProgress&gt;         </pre>       </td>    </tr>
</table>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="PlaceHolderFooter" Runat="Server">
</asp:Content>
using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class tutorials_Ajax_updateprogress : System.Web.UI.Page   {
    protected void Page_Load(object sender, EventArgs e)            {
        try                   {
            impFunctions.WriteMetaTags(this, "updateprogress, asp:updateprogress, updateprogress tutorials, online updateprogress tutorials", "Free online ASP.NET Ajax UpdateProgress control tutorials with live demo, source code and downloadable sample project.", false);
            Label lblSiteMap = (Label)this.Master.FindControl("lblSiteMap");
            lblSiteMap.Text = "<a href=\"/default.aspx\" class=\"siteMap\">Home</a> > <a href=\"/tutorials/\" class=\"siteMap\" title=\"Tutorials Home\">Tutorials</a> > <a href=\"/tutorials/ajax\" class=\"siteMap\">ASP.NET AJAX Tutorials</a> > UpdateProgress Control ";                                }
        catch { }     }
    /// <summary>
    /// Fires when Add Records button is clicked
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void AddRecords(object sender, EventArgs e)     {
        // Sleep the process for 5 seconds to display UpdateProgress contents
        System.Threading.Thread.Sleep(5000);
        string connStr = ConfigurationManager.ConnectionStrings["ConnStr"].ToString( );
        string strSql = string.Empty;
        using (SqlConnection conn = new SqlConnection(connStr))               {
            conn.Open( );            
            strSql = "INSERT INTO SampleForTutorials (Name, Address, Phone, City) VALUES (@Name, @Address, @Phone, @City)";
            SqlCommand dCmd = new SqlCommand(strSql, conn);
            dCmd.Parameters.AddWithValue("@Name", TextBox1.Text.Trim( ));
            dCmd.Parameters.AddWithValue("@Address", TextBox2.Text.Trim( ));
            dCmd.Parameters.AddWithValue("@Phone", TextBox3.Text.Trim( ));
            dCmd.Parameters.AddWithValue("@City", TextBox4.Text.Trim( ));
            dCmd.ExecuteNonQuery( );
            // Reset the textbox value
            TextBox1.Text = "";
            TextBox2.Text = "";
            TextBox3.Text = "";
            TextBox4.Text = "";
            conn.Close( );
            lblMessage.Text = "New Records Entered Successfully !!!";           }                  }

}

Ajax - UpdatePanel


2 UpdatePanel Control
UpdatePanel control is a central part of ASP.NET AJAX functionality. It is used with ScriptManager control to enable partial rendering of the page. You must be aware that partial page rendering reduces the need for synchronous postbacks and complete page updates when a part of the page need to be updated.
There are bunch of properties and method associated with UpdatePanel control but I am going to show few properties that are oftenly used.
ChildControlsCreated
Gets or sets a value that indicates whether the server control's child control have been created.
ChildrenAsTriggers
Gets or sets a value that indicates whether postback from immediate child controls of an UpdatePanel control updates the panel's content.
ClientID
Gets the server control identifier generated by ASP.NET
ContentTemplate
This is the must use property of the UpdatePanel control. Gets or sets the template that defines the content of the UpdatePanel control. You need to place content of the page that you want to be in the UpdatePanel inside this.
EnableTheming
Gets or sets a value that indicates whether themes apply to this control.
EnableViewState
Gets or sets a value (true/false) that indicates whether the server control persists its and its child control view state.
IsInPartialRendering
Gets or sets a value (true/false) that indicates whether UpdatePanel control is being updated as a result of an asynchornous postbacks.
RenderMode
Gets or sets a value (Block/Inline) that indicates whether content is enclosed with HTML div (block) or span (inline).
Triggers
Gets an UpdatePanelTriggerCollection object that contains AsyncPostBackTrigger and PostBackTrigger objects that were registered for the UpdatePanel control.
UpdateMode
Gets or sets a value (Always/Conditional) that indicates when an UpdatePanel controls content is updated. Always: Update the content of the UpdatePanel irrespective any postback. Conditional: Update the content of the UpdatePanel when control triggers associated with this UpdatePanel.

DEMO : UpdatePanel
Try using Edit/Delete and notice whole page is not refreshing

Delete?
10898




10896
d
d
3
d
10862
dfg
dfg
dfg
dfg
10893
Gabriel Jorge
Quifica 38
937606245
Luanda
10877
gbergert
werwerwer
rwerwe
rwerwe
1
2
3
4
5
6
7
8
9
// Update Panel
<asp:UpdatePanel runat="Server" ID="UpdatePanel1" UpdateMode="Conditional">
    // Content Template, You can put whatever content you want,
    // any event fires inside this block will update this block content only
    <ContentTemplate>
   
        <asp:GridView ID="GridView1" runat="server" DataSourceID="SqlDataSource1" Caption="Try using Edit/Delete and notice whole page is not refreshing"
            AllowPaging="True" AllowSorting="True" AutoGenerateEditButton="true" DataKeyNames="AutoID"
            PageSize="5" CellPadding="2" CellSpacing="1" EmptyDataText="<b>Sorry, There are no records to show in GridView. </b>">
            <Columns>
                <asp:TemplateField HeaderText="Delete?">
                    <ItemTemplate>
                        <asp:LinkButton ID="lnk1" runat="server" Text="Delete" OnClientClick="return confirm('Are you sure to Delete?')"
                            CommandName="Delete"></asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
       
        // SqlDataSource, the datasource of the GridView
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString='<%$ ConnectionStrings:ConnStr %>'
            SelectCommand="Select * FROM SampleForTutorials ORDER BY [Name]" DeleteCommand="Delete FROM SampleForTutorials WHERE AutoID = @AutoID"
            UpdateCommand="UPDATE SampleForTutorials SET Name = @Name, Address = @Address, Phone = @Phone, City = @City WHERE AutoID = @AutoID">
            <DeleteParameters>
                <asp:Parameter Name="AutoID" />
            </DeleteParameters>
            <UpdateParameters>
                <asp:Parameter Name="AutoID" Type="Int32" />
                <asp:Parameter Name="Name" Type="string" Size="50" />
                <asp:Parameter Name="Address" Type="string" Size="200" />
                <asp:Parameter Name="Phone" Type="string" />
                <asp:Parameter Name="City" Type="string" Size="20" />
            </UpdateParameters>
        </asp:SqlDataSource>
       
    </ContentTemplate>
</asp:UpdatePanel>

Updatepanel.aspx
<asp:Content ID="Content1" ContentPlaceHolderID="PlaceHolderHeader" Runat="Server">  </asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="PlaceHolderForTitleAndIntro" Runat="Server">
<div class="ArticleTitle"><h1>UpdatePanel Control</h1></div>
<div class="ArticleContents">
UpdatePanel control is a central part of ASP.NET AJAX functionality. It is used with <a href="scriptmanager.aspx">ScriptManager</a> control to enable partial rendering of the page. You must be aware that partial page rendering reduces the need for synchronous postbacks and complete page updates when a part of the page need to be updated.
</div>   </asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="PlaceHolderForContents" Runat="Server">
<div class="ArticleContents">
<p>There are bunch of properties and method associated with UpdatePanel control but I am going to show few properties that are oftenly used.</p></div>
<table width="98%" class="TutoPropPlaceHolder" border="1" cellpadding="2" cellspacing="1">
<tr>   <td class="DemoCP">ChildControlsCreated</td>
    <td>  Gets or sets a value that indicates whether the server control's child control have been created.  </td></tr>
<tr>    <td class="DemoCP">ChildrenAsTriggers</td>
    <td>        Gets or sets a value that indicates whether postback from immediate child controls of an UpdatePanel control updates the panel's content.    </td></tr>
<tr>    <td class="DemoCP">ClientID</td>
    <td>        Gets the server control identifier generated by ASP.NET    </td></tr>
<tr>    <td class="DemoCP">ContentTemplate</td>
    <td> This is the must use property of the UpdatePanel control. Gets or sets the template that defines the content of UpdatePanel control. U need to place content of the page that you want to be in the UpdatePanel inside this.  </td></tr>
<tr>    <td class="DemoCP">EnableTheming</td>
    <td>        Gets or sets a value that indicates whether themes apply to this control.    </td></tr>
<tr>    <td class="DemoCP">EnableViewState</td>
    <td> Gets or sets a value (true/false) that indicates whether the server control persists its and its child control view 
state.    </td></tr>
<tr>    <td class="DemoCP">IsInPartialRendering</td>
    <td>        Gets or sets a value (true/false) that indicates whether UpdatePanel control is being updated as a result of an asynchornous postbacks.    </td></tr>
<tr>    <td class="DemoCP">RenderMode</td>
    <td>       Gets or sets a value (Block/Inline) that indicates whether content is enclosed with HTML div (block) or span (inline).    </td></tr>
<tr>    <td class="DemoCP">Triggers</td>
    <td>        Gets an UpdatePanelTriggerCollection object that contains AsyncPostBackTrigger and PostBackTrigger objects that were registered for the UpdatePanel control.    </td></tr>
<tr>    <td class="DemoCP">UpdateMode</td>
    <td>     Gets or sets a value (Always/Conditional) that indicates when an UpdatePanel controls content is updated. <b>Always:</b> Update the content of the UpdatePanel irrespective any postback. <b>Conditional:</b> Update the content of the UpdatePanel when control triggers associated with this UpdatePanel.            </td></tr>
</table>
<!-- START - Demo Section -->
        <table class="DemoPlaceHolder" border="1" cellpadding="2" cellspacing="4">
            <tr>             <td class="DemoTitle">                 DEMO : UpdatePanel                </td>
                <td align="right">             <a class="DemoShowSource" href="../../misc/codeviewer/default.aspx?pagename=~/tutorials/ajax/updatepanel.aspx" target="_blank">Show Source Code</a>               </td>             </tr>
            <tr>                <td>                  <asp:UpdatePanel runat="Server" ID="UpdatePanel1" UpdateMode="Conditional">
                        <ContentTemplate>                       
            <asp:GridView ID="GridView1" runat="server" DataSourceID="SqlDataSource1" Caption="Try using Edit/Delete and notice whole page is not refreshing"  AllowPaging="True"  AllowSorting="True"  AutoGenerateEditButton="true"  DataKeyNames="AutoID"  PageSize="5"  CellPadding="2"  CellSpacing="1" EmptyDataText=" <b>Sorry, There are  no  records to show in GridView. Try Inserting records from <a href='/tutorials/controls/formview.aspx'>FormView Control </a> tutorial.</b>">
    <Columns>
        <asp:TemplateField HeaderText="Delete?">
              <ItemTemplate>
    <asp:LinkButton ID="lnk1" runat="server" Text="Delete" OnClientClick="return confirm('Are you sure to Delete?')"
                                                CommandName="Delete"></asp:LinkButton>
              </ItemTemplate>
        </asp:TemplateField>
    </Columns>
</asp:GridView>                          
      <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString='<%$ ConnectionStrings:ConnStr %>'
       SelectCommand="Select * FROM SampleForTutorials ORDER BY [Name]" DeleteCommand="Delete FROM SampleForTutorials WHERE AutoID = @AutoID"  UpdateCommand="UPDATE SampleForTutorials SET  Name = @Name,  Address =  @Address, Phone = @Phone, City = @City WHERE AutoID = @AutoID">    
     <DeleteParameters>   <asp:Parameter Name="AutoID" /> </DeleteParameters>
     <UpdateParameters>
        <asp:Parameter Name="AutoID" Type="Int32" />      <asp:Parameter Name="Name" Type="string" Size="50" />
        <asp:Parameter Name="Address" Type="string" Size="200" />   <asp:Parameter Name="Phone" Type="string" />
        <asp:Parameter Name="City" Type="string" Size="20" />
    </UpdateParameters> </asp:SqlDataSource>                        </ContentTemplate>
 </asp:UpdatePanel>
<asp:UpdateProgress ID="Up1" runat="Server" AssociatedUpdatePanelID="UpdatePanel1">
 <ProgressTemplate>  <span style="background-color:Yellow;"> <img src= "/images/wait.gif"  alt="Please wait" /> Please wait ...</span>   </ProgressTemplate>
                    </asp:UpdateProgress>    </td>
 <td> <a href="../../userfiles/samples/dotnetfundaaspajax.zip">Download Sample project with Source Code</a></td>
 </tr> <tr>   <td colspan="2">    <pre>  <b>// Update Panel</b>
&lt;asp:UpdatePanel runat="Server" ID="UpdatePanel1" UpdateMode="Conditional"&gt;
    <b>// Content Template, You can put whatever content you want,
    // any event fires inside this block will update this block content only </b>       &lt;ContentTemplate&gt;   
        &lt;asp:GridView ID="GridView1" runat="server" DataSourceID="SqlDataSource1" Caption="Try using Edit/Delete and notice whole page is not refreshing"             AllowPaging="True"  AllowSorting="True"  AutoGenerateEditButton= "true" DataKeyNames="AutoID"  PageSize="5" CellPadding="2" CellSpacing="1"  EmptyDataText= "&lt;b&gt;Sorry,  There are no records to show in GridView. &lt;/b&gt;"&gt;  &lt;Columns&gt; &lt;asp:TemplateField  HeaderText= "Delete?"&gt;   &lt;ItemTemplate&gt;
                        &lt;asp:LinkButton ID="lnk1" runat="server"  Text="Delete" OnClientClick= "return confirm ('Are you  sure  to Delete?')"  CommandName="Delete"&gt;&lt;/asp:LinkButton&gt;     &lt;/ItemTemplate&gt;
                &lt;/asp:TemplateField&gt;            &lt;/Columns&gt;           &lt;/asp:GridView&gt;       
       <b> // SqlDataSource, the datasource of the GridView</b>        &lt;asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString='&lt;%$ ConnectionStrings:ConnStr %&gt;'
            SelectCommand="Select * FROM SampleForTutorials ORDER BY [Name]" DeleteCommand="Delete FROM SampleForTutorials WHERE AutoID = @AutoID"
            UpdateCommand="UPDATE SampleForTutorials SET Name = @Name, Address = @Address, Phone = @Phone, City = @City WHERE AutoID = @AutoID"&gt;
            &lt;DeleteParameters&gt;                          &lt;asp:Parameter Name="AutoID" /&gt;             &lt;/DeleteParameters&gt;                            &lt;UpdateParameters&gt;
                &lt;asp:Parameter Name="AutoID" Type="Int32" /&gt;
                &lt;asp:Parameter Name="Name" Type="string" Size="50" /&gt;
                &lt;asp:Parameter Name="Address" Type="string" Size="200" /&gt;
                &lt;asp:Parameter Name="Phone" Type="string" /&gt;
                &lt;asp:Parameter Name="City" Type="string" Size="20" /&gt;
            &lt;/UpdateParameters&gt;                                   &lt;/asp:SqlDataSource&gt;                                    &lt;/ContentTemplate&gt;
&lt;/asp:UpdatePanel&gt;</pre>                     </td>                        </tr>
</table>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="PlaceHolderFooter" Runat="Server">
</asp:Content>
Updatepanel.aspx.cs
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class tutorials_Ajax_updatepanel : System.Web.UI.Page   {
    protected void Page_Load(object sender, EventArgs e)                {
        try          {
            impFunctions.WriteMetaTags(this, "updatepanel, asp:updatepanel, updatepanel tutorials, online updatepanel tutorials", "Free online ASP.NET Ajax UpdatePanel control tutorials with live demo, source code and downloadable sample project.", false);
            Label lblSiteMap = (Label)this.Master.FindControl("lblSiteMap");
            lblSiteMap.Text = "<a href=\"/default.aspx\" class=\"siteMap\">Home</a> > <a href=\"/tutorials/\" class=\"siteMap\" title=\"Tutorials Home\">Tutorials</a> > <a href=\"/tutorials/ajax\" class=\"siteMap\">ASP.NET AJAX Tutorials</a> > UpdatePanel Control ";                        }
        catch { }            }
}