title: How to pass value from ModalPopupExtender to Gridview footer row textbox on buttonclick
body: <p>I am trying to pass value from listbox in ModalPopupExtender to textbox in gridview footer row textbox in parent page. In the current scenario the application breaks on button click. I have tried using Javascript,juery and C# but all results in same. Does somebody has any suggestion on how to do this? Below is my code:</p>
  
  <p>I am trying to Pass value from listbox "lst_PdfViewers" to gridview textbox "AddSupplierName" on Done button click event "btnSupplierDone_Click" </p>
  
  <p>Gridview Footer row: </p>
  
  <pre><code>&lt;FooterTemplate&gt;                
       &lt;asp:TextBox ID="AddSupplierName" runat="server"  &gt;                                                             
            &lt;/asp:TextBox&gt;
       &lt;asp:ImageButton ID="btnlnkSupplier" runat="server" ImageUrl="../images/openDialog20.gif" 
           onclick ="lnkSupplier_Click"  /&gt; 
   &lt;/FooterTemplate&gt;
  </code></pre>
  
  <p>ModalPopupExtender:</p>
  
  <pre><code>&lt;act:ModalPopupExtender ID="ModalPopupExtenderSupplier" CancelControlID="SupplierPopupCancel"  TargetControlID="Sample" 
     PopupControlID="Pnl_Pdfviewers" runat="server" Enabled="true"&gt; &lt;/act:ModalPopupExtender&gt;
  </code></pre>
  
  <p>Popup Div having Listbox and Done Button:</p>
  
  <pre><code>&lt;div id="Pnl_Pdfviewers" style="display: none; width: 500px !important; height: 400px !important;"
      class="popupConfirmation"&gt;
      &lt;div class="popup_Titlebar" id="div3"&gt;
          &lt;div class="TitlebarRight" onclick="$get('SupplierPopupCancel').click();"&gt;
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;div id="div4" class="popup_Container popup_Body" style="overflow: auto; height: 125px;"&gt;
          &lt;table id="Table2" class="table" style="table-layout: fixed; width: 450px;"&gt;
              &lt;tr&gt;
                  &lt;td style="word-wrap: break-word;"&gt;
                      &lt;asp:ListBox ID="lst_PdfViewers" Width="250px" runat="server" OnSelectedIndexChanged="lst_PdfViewers_SelectedIndexChanged"&gt;&lt;/asp:ListBox&gt;
                  &lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td style="word-wrap: break-word;"&gt;
                      &lt;%--&lt;input type="button" id="btn1"   OnClick="btnSupplierDone_Click" value="Client Button" /&gt;--%&gt;
                      &lt;asp:Button ID="BtnSupplierDone" runat="server" CausesValidation="False" OnClick="btnSupplierDone_Click" Text="Done" /&gt;
                  &lt;/td&gt;
              &lt;/tr&gt;
          &lt;/table&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>.cs btnSupplierDone_Click event</p>
  
  <pre><code>protected void btnSupplierDone_Click(object sender, EventArgs e)
  {
      if (lst_PdfViewers.SelectedValue != null)
      {
          var footerRow = gvPITransactionData.FooterRow;
          var txtAddSupplierName = (TextBox)footerRow.FindControl("AddSupplierName");
          lst_PdfViewers.SelectedValue = txtAddSupplierName.Text;
          // ModalPopupExtenderSupplier.Hide();
      }
  }
  </code></pre>