Link Button Click event error due to UpdatePanel
<p>I have Two link buttons : lnkViewAll &amp; lnkPaging and a GridView : GridView1 within the same  control and . The feature is - when the first time the grid will bind it will show the records by paging(10 records in a page). Then if we click the 'View All' button it will show all the records with no paging.Now if again we click the 'Paging' button the grid will again show the records by paging. Up to the 'View All' Button click it is working fine but if we then click on the paging button the error is coming saying UpdatePanel does not exist.</p>

<p>The code is as follows:</p>

<pre><code>&lt;pre lang="xml"&gt;&amp;&lt;pre lang="HTML"&gt;&lt;pre lang="HTML"&gt;&lt;pre lang="HTML"&gt;&lt;pre lang="HTML"&gt;&lt;pre lang="HTML"&gt;&lt;pre lang="HTML"&gt;&lt;pre lang="HTML"&gt;&lt;pre lang="text"&gt;&lt;pre lang="Javascript"&gt;&lt;pre lang="HTML"&gt;&lt;/pre&gt;&lt;/pre&gt;&lt;/pre&gt;&lt;/pre&gt;&lt;/pre&gt;&lt;/pre&gt;&lt;/pre&gt;&lt;/pre&gt;&lt;/pre&gt;&lt;/pre&gt;lt;asp1:UpdatePanel ID=&amp;quot;UpdatePanelSortOrder&amp;quot; runat=&amp;quot;server&amp;quot; UpdateMode=&amp;quot;Conditional&amp;quot;&amp;gt;
                    &amp;lt;ContentTemplate&amp;gt;
                        &amp;lt;table cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;3&amp;quot; width=&amp;quot;100%&amp;quot; border=&amp;quot;0&amp;quot;&amp;gt;
                            &amp;lt;tr&amp;gt;
                                &amp;lt;td align=&amp;quot;center&amp;quot;&amp;gt;
                                    &amp;lt;ul class=&amp;quot;buttons&amp;quot;&amp;gt;
                                        &amp;lt;li&amp;gt;
                                            &amp;lt;asp:LinkButton ID=&amp;quot;lnkViewAll&amp;quot; runat=&amp;quot;server&amp;quot; CssClass=&amp;quot;BlueButtonApp&amp;quot; meta:resourcekey=&amp;quot;btnSearch&amp;quot;
                                                OnClick=&amp;quot;lnkViewAll_Click&amp;quot;&amp;gt;View All&amp;lt;/asp:LinkButton&amp;gt;
                                        &amp;lt;/li&amp;gt;
                                        &amp;lt;li class=&amp;quot;right&amp;quot;&amp;gt;&amp;lt;/li&amp;gt;
                                        &amp;lt;li&amp;gt;
                                            &amp;lt;asp:LinkButton ID=&amp;quot;lnkPaging&amp;quot; runat=&amp;quot;server&amp;quot; CssClass=&amp;quot;BlueButtonApp&amp;quot; meta:resourcekey=&amp;quot;btnClear&amp;quot;
                                                OnClick=&amp;quot;lnkPaging_Click&amp;quot;&amp;gt;View By Paging&amp;lt;/asp:LinkButton&amp;gt;
                                        &amp;lt;/li&amp;gt;
                                        &amp;lt;li class=&amp;quot;right&amp;quot;&amp;gt;&amp;lt;/li&amp;gt;
                                    &amp;lt;/ul&amp;gt;
                                    &amp;lt;asp:HiddenField ID=&amp;quot;HiddenField1&amp;quot; runat=&amp;quot;server&amp;quot;&amp;gt;&amp;lt;/asp:HiddenField&amp;gt;
                                &amp;lt;/td&amp;gt;
                            &amp;lt;/tr&amp;gt;
                        &amp;lt;/table&amp;gt;
                        &amp;lt;!-- Grid starts here --&amp;gt;
                        &amp;lt;div id=&amp;quot;div1&amp;quot;&amp;gt;
                            &amp;lt;asp:GridView ID=&amp;quot;gvProcessArea&amp;quot; runat=&amp;quot;server&amp;quot; EmptyDataText=&amp;quot;No Records Found&amp;quot;
                                CaptionAlign=&amp;quot;Left&amp;quot; Width=&amp;quot;99%&amp;quot; CellPadding=&amp;quot;1&amp;quot; AutoGenerateColumns=&amp;quot;False&amp;quot; AllowSorting=&amp;quot;True&amp;quot;
                                EnableTheming=&amp;quot;True&amp;quot; BorderWidth=&amp;quot;0px&amp;quot; BorderStyle=&amp;quot;None&amp;quot; PageSize=&amp;quot;10&amp;quot; UseCustomPager=&amp;quot;True&amp;quot;
                                GridLines=&amp;quot;None&amp;quot; GridAlternateRowStyle=&amp;quot;&amp;quot; GridCellPadding=&amp;quot;3&amp;quot; OnDataBound=&amp;quot;gvProcessArea_DataBound&amp;quot;
                                GridCellSpacing=&amp;quot;0&amp;quot; GridDataText_NORECORDFOUND=&amp;quot;No Record Found&amp;quot; GridDropDownStyle=&amp;quot;&amp;quot;
                                GridHeaderStyle=&amp;quot;&amp;quot; GridPageIndex=&amp;quot;0&amp;quot; GridPagerStyle=&amp;quot;&amp;quot; GridRowStyle=&amp;quot;&amp;quot; meta:resourcekey=&amp;quot;gvProcessArea&amp;quot;
                                OnRowCommand=&amp;quot;gvProcessArea_RowCommand&amp;quot; OnRowDataBound=&amp;quot;gvProcessArea_RowDataBound&amp;quot;
                                OnRowCreated=&amp;quot;gvProcessArea_RowCreated&amp;quot;&amp;gt;
                                &amp;lt;HeaderStyle CssClass=&amp;quot;tableHDGridViewV2&amp;quot; ForeColor=&amp;quot;Black&amp;quot;&amp;gt;&amp;lt;/HeaderStyle&amp;gt;
                                &amp;lt;RowStyle CssClass=&amp;quot;blueRow&amp;quot; /&amp;gt;
                                &amp;lt;AlternatingRowStyle CssClass=&amp;quot;whiteRow&amp;quot; /&amp;gt;
                                &amp;lt;FooterStyle CssClass=&amp;quot;whiteRow&amp;quot;&amp;gt;&amp;lt;/FooterStyle&amp;gt;
                                &amp;lt;Columns&amp;gt;
                                    &amp;lt;asp:TemplateField&amp;gt;
                                        &amp;lt;ItemTemplate&amp;gt;
                                            &amp;lt;asp:Label ID=&amp;quot;lblLookupID&amp;quot; runat=&amp;quot;server&amp;quot; Text=&amp;#39;&amp;lt;%# Eval(&amp;quot;process_area_id&amp;quot;) %&amp;gt;&amp;#39;
                                                Visible=&amp;quot;false&amp;quot;&amp;gt;&amp;lt;/asp:Label&amp;gt;
                                            &amp;lt;asp:HiddenField ID=&amp;quot;hdfLookUPID&amp;quot; runat=&amp;quot;server&amp;quot; Value=&amp;#39;&amp;lt;%# Eval(&amp;quot;process_area_id&amp;quot;)%&amp;gt;&amp;#39;&amp;gt;
                                            &amp;lt;/asp:HiddenField&amp;gt;
                                        &amp;lt;/ItemTemplate&amp;gt;
                                        &amp;lt;HeaderStyle HorizontalAlign=&amp;quot;Center&amp;quot;&amp;gt;&amp;lt;/HeaderStyle&amp;gt;
                                        &amp;lt;ItemStyle HorizontalAlign=&amp;quot;Center&amp;quot; Width=&amp;quot;0%&amp;quot;&amp;gt;&amp;lt;/ItemStyle&amp;gt;
                                    &amp;lt;/asp:TemplateField&amp;gt;
                                    &amp;lt;asp:BoundField DataField=&amp;quot;process_area_name&amp;quot; HeaderText=&amp;quot;Process Area&amp;quot; SortExpression=&amp;quot;process_area_name&amp;quot;
                                        meta:resourceKey=&amp;quot;LOOKUP_NAMEResource&amp;quot;&amp;gt;
                                        &amp;lt;HeaderStyle Wrap=&amp;quot;True&amp;quot; Width=&amp;quot;80%&amp;quot;&amp;gt;&amp;lt;/HeaderStyle&amp;gt;
                                        &amp;lt;ItemStyle Wrap=&amp;quot;True&amp;quot;&amp;gt;&amp;lt;/ItemStyle&amp;gt;
                                    &amp;lt;/asp:BoundField&amp;gt;
                                    &amp;lt;asp:TemplateField HeaderText=&amp;quot;Status&amp;quot; SortExpression=&amp;quot;approval_status&amp;quot; meta:resourcekey=&amp;quot;APPROVAL_STATUSResource&amp;quot;&amp;gt;
                                        &amp;lt;ItemStyle Width=&amp;quot;20%&amp;quot; HorizontalAlign=&amp;quot;Left&amp;quot;&amp;gt;&amp;lt;/ItemStyle&amp;gt;
                                        &amp;lt;HeaderStyle Width=&amp;quot;40%&amp;quot; HorizontalAlign=&amp;quot;Left&amp;quot;&amp;gt;&amp;lt;/HeaderStyle&amp;gt;
                                        &amp;lt;ItemTemplate&amp;gt;
                                            &amp;lt;asp:Label runat=&amp;quot;server&amp;quot; Text=&amp;#39;&amp;lt;%#Eval(&amp;quot;approval_status&amp;quot;) %&amp;gt;&amp;#39; ID=&amp;quot;lblApprovalStatus&amp;quot;&amp;gt;&amp;lt;/asp:Label&amp;gt;
                                        &amp;lt;/ItemTemplate&amp;gt;
                                    &amp;lt;/asp:TemplateField&amp;gt;
                                    &amp;lt;asp:TemplateField HeaderText=&amp;quot;Sorting Order&amp;quot; SortExpression=&amp;quot;sort_order&amp;quot;&amp;gt;
                                        &amp;lt;ItemStyle&amp;gt;&amp;lt;/ItemStyle&amp;gt;
                                        &amp;lt;HeaderStyle Width=&amp;quot;80%&amp;quot; HorizontalAlign=&amp;quot;Left&amp;quot;&amp;gt;&amp;lt;/HeaderStyle&amp;gt;
                                        &amp;lt;ItemTemplate&amp;gt;
                                            &amp;lt;asp:DropDownList ID=&amp;quot;ddlSortOrder&amp;quot; Width=&amp;quot;50px&amp;quot; runat=&amp;quot;server&amp;quot; AutoPostBack=&amp;quot;True&amp;quot;
                                                OnSelectedIndexChanged=&amp;quot;ddlSortOrder_SelectedIndexChanged&amp;quot;&amp;gt;
                                            &amp;lt;/asp:DropDownList&amp;gt;
                                            &amp;lt;asp:HiddenField ID=&amp;quot;hdfSortOrder&amp;quot; runat=&amp;quot;server&amp;quot; Value=&amp;#39;&amp;lt;%# Eval(&amp;quot;sort_order&amp;quot;)%&amp;gt;&amp;#39;&amp;gt;
                                            &amp;lt;/asp:HiddenField&amp;gt;
                                        &amp;lt;/ItemTemplate&amp;gt;
                                    &amp;lt;/asp:TemplateField&amp;gt;
                                &amp;lt;/Columns&amp;gt;
                            &amp;lt;/asp:GridView&amp;gt;
                            &amp;lt;%--&amp;lt;asp:ObjectDataSource ID=&amp;quot;odsProcessArea&amp;quot; runat=&amp;quot;server&amp;quot; OldValuesParameterFormatString=&amp;quot;original_{0}&amp;quot;
                                SelectMethod=&amp;quot;GetProcessAreaToBind&amp;quot; TypeName=&amp;quot;com.Citi.Citigroup.RACFramework.Web.UI.Common.CacheObjects.CacheProcessArea&amp;quot;
                                SelectCountMethod=&amp;quot;GetProcessAreaCountGrid&amp;quot; MaximumRowsParameterName=&amp;quot;liMaxRecords&amp;quot;
                                StartRowIndexParameterName=&amp;quot;liStartRecord&amp;quot; SortParameterName=&amp;quot;lsSortExpression&amp;quot;
                                EnablePaging=&amp;quot;True&amp;quot; OnSelected=&amp;quot;odsProcessArea_Selected&amp;quot; OnSelecting=&amp;quot;odsProcessArea_Selecting&amp;quot;&amp;gt;
                            &amp;lt;/asp:ObjectDataSource&amp;gt;--%&amp;gt;
                            &amp;lt;asp:TextBox ID=&amp;quot;txtCapsSearchCriteria&amp;quot; runat=&amp;quot;server&amp;quot; Visible=&amp;quot;False&amp;quot; /&amp;gt;
                        &amp;lt;/div&amp;gt;
                    &amp;lt;/ContentTemplate&amp;gt;
                    &amp;lt;%--&amp;lt;Triggers&amp;gt;
                        &amp;lt;asp:AsyncPostBackTrigger ControlID=&amp;quot;lnkViewAll&amp;quot; EventName=&amp;quot;Click&amp;quot; /&amp;gt;
                        &amp;lt;asp:AsyncPostBackTrigger ControlID=&amp;quot;lnkPaging&amp;quot; EventName=&amp;quot;Click&amp;quot; /&amp;gt;
                    &amp;lt;/Triggers&amp;gt;--%&amp;gt;
                &amp;lt;/asp1:UpdatePanel&amp;gt;&lt;/pre&gt;
</code></pre>

<h1>region Button Click Events</h1>

<pre><code>    protected void lnkViewAll_Click(object sender, EventArgs e)
    {
        try
        {
            //IsAllRecords = true;

            DataTable dtProcessArea = new DataTable();

            Common.CacheObjects.CacheProcessArea lobjProcessArea = new Common.CacheObjects.CacheProcessArea();

            dtProcessArea = lobjProcessArea.GetProcessAreaAll();

            gvProcessArea.DataSource = dtProcessArea;

            gvProcessArea.AllowPaging = false;

            IsAllRecords = true;

            gvProcessArea.DataBind();


            PopulatePaging();
            UpdatePanelSortOrder.Update();
        }
        catch (Exception objException)
        {

            hdnErrorDisplayer.Value = (hdnErrorDisplayer.Value == "false") ? "true" : "false";
            ErrDisplayer1.DisplayError(objException);

        }

    }

    protected void lnkPaging_Click(object sender, EventArgs e)
    {
        try
        {
            DataTable dtProcessArea = new DataTable();

            Common.CacheObjects.CacheProcessArea lobjProcessArea = new Common.CacheObjects.CacheProcessArea();

            dtProcessArea = lobjProcessArea.GetProcessAreaAll();

            gvProcessArea.DataSource = dtProcessArea;

            gvProcessArea.AllowPaging = true;

            IsAllRecords = false;

            gvProcessArea.DataBind();                

            PopulatePaging();
            UpdatePanelSortOrder.Update();
        }
        catch (Exception objException)
        {

            hdnErrorDisplayer.Value = (hdnErrorDisplayer.Value == "false") ? "true" : "false";
            ErrDisplayer1.DisplayError(objException);

        }

    }

    #endregion
</code></pre>
