title: GridView linkbutton not causing external UpdatePanel to refresh
body: <p>I have an asp page with a regular panel that contains a gridview. The gridview has some linkbuttons that are used to generate a pdf.</p>
  
  <p>I also have an UpdatePanel inside the regular panel and below the gridview that contains a label.</p>
  
  <p>When the user clicks the 'generate' linkbutton inside the gridview, I want the label to say 'report generating' or something like that.</p>
  
  <p>I have been unable to get this to work at all. I can throw values into the label all day long and nothing.</p>
  
  <p>Here is the code for the panel:</p>
  
  <pre><code>&lt;asp:Panel ID="ReportsPanel" runat="server" Height="611px"&gt;
      &lt;h2&gt;
          Reports
      &lt;/h2&gt;
      &lt;asp:Label ID="ReportsNotification" runat="server"&gt;&lt;/asp:Label&gt;
      &lt;br /&gt;
      &lt;asp:Label ID="Label1" runat="server" Text="Pharmacy: "&gt;&lt;/asp:Label&gt;
      &lt;asp:DropDownList ID="PharmaciesDropDownList" runat="server" AutoPostBack="true"
          OnSelectedIndexChanged="PharmaciesDropDownList_SelectedIndexChanged"&gt;
      &lt;/asp:DropDownList&gt;
      &lt;br /&gt;
      &lt;br /&gt;
      &lt;asp:GridView ID="ListReportsGridView" runat="server" AllowPaging="true" AllowSorting="true"
          GridLines="None" PageSize="10" CssClass="GridView" AutoGenerateColumns="false"
          EmptyDataText="No rows for selection." OnRowCommand="ListReportsGridView_RowCommand"
          OnPageIndexChanging="ListReportsGridView_PageIndexChanging"
          EnablePersistedSelection="True"
          DataKeyNames="FinDataID"&gt;
          &lt;AlternatingRowStyle CssClass="GridViewAltRow" /&gt;
          &lt;HeaderStyle CssClass="GridViewHeader" /&gt;
          &lt;RowStyle CssClass="GridViewItem" /&gt;
          &lt;PagerStyle CssClass="GridViewPager" /&gt;
          &lt;Columns&gt;
              &lt;asp:BoundField DataField="ID" HeaderText="ID" ControlStyle-CssClass="Hidden" ItemStyle-CssClass="Hidden"
                  HeaderStyle-CssClass="Hidden" FooterStyle-CssClass="Hidden" /&gt;
              &lt;asp:BoundField DataField="FinDataID" HeaderText="FinDataID" ControlStyle-CssClass="Hidden" ItemStyle-CssClass="Hidden"
                  HeaderStyle-CssClass="Hidden" FooterStyle-CssClass="Hidden" /&gt;
              &lt;asp:BoundField DataField="PeriodStart" HeaderText="Period Start" DataFormatString="{0:dd/MM/yyyy}" /&gt;
              &lt;asp:BoundField DataField="PeriodEnd" HeaderText="Period End" DataFormatString="{0:dd/MM/yyyy}" /&gt;
              &lt;asp:TemplateField HeaderText="Reports Available for Download"&gt;&lt;ItemTemplate&gt;&lt;asp:LinkButton ID="LinkButtonViewRpt" Text='&lt;%#Eval("FileName") %&gt;' CommandName="ViewRpt" CommandArgument="&lt;%# Container.DataItemIndex %&gt;" runat="server"&gt;&lt;/asp:LinkButton&gt;&lt;/ItemTemplate&gt;&lt;/asp:TemplateField&gt;    
              &lt;asp:TemplateField Visible="false"&gt;&lt;ItemTemplate&gt;&lt;asp:LinkButton ID="LinkButtonGenerateRpt" Text='Generate' CommandName="GenerateRpt" CommandArgument="&lt;%# Container.DataItemIndex %&gt;" runat="server"&gt;&lt;/asp:LinkButton&gt;&lt;/ItemTemplate&gt;&lt;/asp:TemplateField&gt;    
              &lt;asp:TemplateField Visible="false"&gt;&lt;ItemTemplate&gt;&lt;asp:LinkButton ID="LinkButtonUploadRpt" Text='Upload' CommandName="UploadRpt" CommandArgument="&lt;%# Container.DataItemIndex %&gt;" runat="server"&gt;&lt;/asp:LinkButton&gt;&lt;/ItemTemplate&gt;&lt;/asp:TemplateField&gt;    
          &lt;/Columns&gt;
      &lt;/asp:GridView&gt;
      &lt;asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional"&gt;
          &lt;Triggers&gt;
              &lt;asp:AsyncPostBackTrigger ControlID="LinkButtonGenerateRpt" EventName="Click" /&gt;
          &lt;/Triggers&gt;
          &lt;ContentTemplate&gt;
              &lt;asp:Label ID="lblMessage" runat="server" Text=""&gt;&lt;/asp:Label&gt;
          &lt;/ContentTemplate&gt;
      &lt;/asp:UpdatePanel&gt;
      &lt;br /&gt;
  &lt;/asp:Panel&gt;
  </code></pre>
  
  <p>I've tried with a button in the UpdatePanel, outside the UpdatePanel but neither of those ideas worked either. Surely this is possible!</p>
  
  <p>The one thing I'm wondering, is when the 'generate' button fires and creates the pdf it is calling Response.End. I know this will end the thread and not reload the page. But I was hoping I could refresh the UpdatePanel <em>before</em> this happens... from what I can tell that's what UpdatePanel's are for, partial page updates.</p>
  
  <p>Here is the code behind for the gridview:</p>
  
  <pre><code>protected void ListReportsGridView_RowCommand(object sender, GridViewCommandEventArgs e)
  {
      intIndex = Convert.ToInt32(e.CommandArgument);
      if (e.CommandName == "GenerateRpt")
      {//render pdf
  
          //populate empty report object with row information
          objFileData = new FileData();
          objFileData.PharmacyID = Convert.ToInt32(PharmaciesDropDownList.SelectedValue);
          objFileData.FinDataID = Convert.ToInt32(ListReportsGridView.Rows[intIndex].Cells[1].Text);
          objFileData.CreateDate = Convert.ToDateTime(DateTime.Now);
          objFileData.CreatedByID = Convert.ToInt32(Session["UserID"]);
          objFileData.PeriodStart = Convert.ToDateTime(ListReportsGridView.Rows[intIndex].Cells[2].Text);
  
          lblMessage.Text = "Report generating...";
          //btnGenerate_Click(sender, e);
          RenderPdf();
  
      }
  </code></pre>
  
  <p>Thanks in advance!</p>
  
  <p>EDIT: And I'm also receiving this error...</p>
  
  <p>A control with ID 'LinkButtonGenerateRpt' could not be found for the trigger in UpdatePanel 'UpdatePanel1'. </p>
  
  <p>Do I need to use the UniqueID or is scope otherwise an issue?</p>