title: how to populate modalpopupextender when gridview button is clicked in asp.net
body: <p>I have one problem, someone maybe can help me.
  I have a gridview and a button to edit the fields in the gridview from within a modalpopupextender. 
  What I want to achieve is when someone will click the edit button, the popup to have the data from the row which needs to be edited.
  As it is now, when someone clicks the edit button, the popup comes up but with blank textboxes/dropdowns there. 
  Here is what I have at this moment:</p>
  
  <pre><code>&lt;ItemTemplate&gt;
     &lt;asp:Button ID="btnEdit" CausesValidation="false" 
         runat="server" Text="Edit" OnClick="Activatee" /&gt;
    &lt;ajaxToolkit:ConfirmButtonExtender ID="btnDeactivatePopup" runat="server" 
         TargetControlID="btnEdit" DisplayModalPopupID="ModalPopupDeactivate" /&gt;
    &lt;ajaxToolkit:ModalPopupExtender 
         ID="ModalPopupDeactivate" runat="server" TargetControlID="btnEdit" 
         PopupControlID="pnlActivate" OkControlID="btnDeactivateOK" 
         CancelControlID="btnDeactivateCancel" BackgroundCssClass="modalBackground" 
         DynamicServicePath="" Enabled="true" /&gt;
  &lt;/ItemTemplate&gt;
  </code></pre>
  
  <p>I tried with another method when the button is clicked, but when I am clicking the edit button, the popup doesn't come out at the page:</p>
  
  <pre><code>  &lt;ItemTemplate&gt;
      &lt;asp:Button ID="btnEdit" CausesValidation="false" 
            runat="server" Text="Edit" OnClick="getData" /&gt;
      &lt;!-- 
      &lt;ajaxToolkit:ConfirmButtonExtender ID="btnDeactivatePopup" 
            runat="server" TargetControlID="btnEdit" 
            DisplayModalPopupID="ModalPopupDeactivate" /&gt; 
      --&gt;
      &lt;ajaxToolkit:ModalPopupExtender ID="ModalPopupDeactivate" 
            runat="server" TargetControlID="btnEdit" PopupControlID="pnlActivate"
            OkControlID="btnDeactivateOK" CancelControlID="btnDeactivateCancel" 
            BackgroundCssClass="modalBackground" DynamicServicePath="" Enabled="true" /&gt;
   &lt;/ItemTemplate&gt;
  </code></pre>
  
  <p>And here is the backend code too for the version above but it doesn't show the popup at the end:</p>
  
  <pre><code> protected void getData(object sender, EventArgs e)
   {
        string coef = "";
        Button btn = (Button)sender;
        GridViewRow gvr = (GridViewRow)btn.NamingContainer;
        int rowindex = gvr.RowIndex;
        GridViewRow roww = gvGDG.Rows[rowindex];
        coef = Convert.ToString(roww.Cells[7].Text);
        txtCoefficient.Text = coef;
        ModalPopupExtender modalPopupExtender1 = 
           (ModalPopupExtender)gvGDG.Rows[rowindex].FindControl("ModalPopupDeactivate");
        modalPopupExtender1.Show();
   }
  </code></pre>
  
  <p>I hope someone can help me with this.
  Thanks a lot, Laziale</p>