title: Get selected Row in a pop up for Edit and Update
body: <p>I have a anchor tag for the updating the row in the gridview. I have set the checkbox in the gridview. When the user checks the checkbox and click on update button the existing row should open in a pop up..</p>
  
  <p>Right now the pop up is opening but not with the checked rows with the existing data. Please see the code for your reference:-</p>
  
  <pre><code>&lt;a id="popup" onclick="div_show()" class="btn btn-success"&gt;&lt;i class="fa fa-plus-circle"&gt;&lt;/i&gt;Add new&lt;/a&gt;
  
  &lt;a href="javascript:;" class="btn btn-primary" runat="server" onclick="div_show()" &gt;&lt;i class="fa fa-refresh"&gt;&lt;/i&gt;Update&lt;/a&gt;
  </code></pre>
  
  <p>Also see the gridview code for your reference:-</p>
  
  <pre><code>&lt;asp:GridView ID="grdCSRPageData" runat="server" Width="100%" border="1" Style="border: 1px solid #E5E5E5;" CellPadding="3"
              AutoGenerateColumns="False" OnDataBound="grdCSRPageData_DataBound" AllowPaging="true" CssClass="hoverTable" EmptyDataText="No Records Found"
              OnPageIndexChanging="grdCSRPageData_PageIndexChanging" DataKeyNames="Id" OnRowDeleting="grdCSRPageData_RowDeleting"
              PageSize="5" ShowFooter="true" OnRowEditing="grdCSRPageData_RowEditing" OnRowUpdating="grdCSRPageData_RowUpdating"
              OnRowCancelingEdit="grdCSRPageData_RowCancelingEdit"&gt;
              &lt;AlternatingRowStyle CssClass="k-alt" BackColor="#f5f5f5" /&gt;
              &lt;Columns&gt;
                  &lt;asp:TemplateField HeaderText="Select" HeaderStyle-Width="5%" HeaderStyle-CssClass="k-grid td"&gt;
                      &lt;ItemTemplate&gt;
                          &lt;asp:CheckBox ID="chkSelect" runat="server" AutoPostBack="false" /&gt;
                      &lt;/ItemTemplate&gt;
                  &lt;/asp:TemplateField&gt;
                  &lt;asp:BoundField DataField="page_title" HeaderText="Page Title" ItemStyle-Width="30" HeaderStyle-CssClass="k-grid td" /&gt;
                  &lt;asp:BoundField DataField="page_description" HeaderText="Page Description" ItemStyle-Width="30" HeaderStyle-CssClass="k-grid td" /&gt;
                  &lt;asp:BoundField DataField="meta_title" HeaderText="Meta Title" ItemStyle-Width="30" HeaderStyle-CssClass="k-grid td" /&gt;
                  &lt;asp:BoundField DataField="meta_keywords" HeaderText="Meta Keywords" ItemStyle-Width="30" HeaderStyle-CssClass="k-grid td" /&gt;
                  &lt;asp:BoundField DataField="meta_description" HeaderText="Meta Description" ItemStyle-Width="30" HeaderStyle-CssClass="k-grid td" /&gt;
                  &lt;asp:BoundField DataField="Active" HeaderText="Active" ItemStyle-Width="30" HeaderStyle-CssClass="k-grid td" /&gt;
                  &lt;asp:TemplateField HeaderText="Action" HeaderStyle-Width="15%" HeaderStyle-CssClass="k-grid td"&gt;
                      &lt;ItemTemplate&gt;
                          &lt;asp:ImageButton ID="btnDelete" AlternateText="Delete" ImageUrl="~/images/delete.png" runat="server" Width="15" Height="15" CommandName="Delete" CommandArgument='&lt;%# Eval("Id") %&gt;' CausesValidation="false" OnClientClick="return confirm('Are you sure you want to delete this record?')" /&gt;
                      &lt;/ItemTemplate&gt;
                  &lt;/asp:TemplateField&gt;
                  &lt;asp:CommandField ButtonType="Image" ItemStyle-Width="15" EditImageUrl="~/images/edit.png" ShowEditButton="True" ControlStyle-Width="15" ControlStyle-Height="15" CancelImageUrl="~/images/close.png" UpdateImageUrl="~/images/update.png"&gt;
                      &lt;ControlStyle Height="20px" Width="20px"&gt;&lt;/ControlStyle&gt;
                  &lt;/asp:CommandField&gt;
              &lt;/Columns&gt;
          &lt;/asp:GridView&gt;
  </code></pre>
  
  <p>Please help, its been since two days I am stucked but couldn't cracked it.</p>
  
  <p>Code for binding the gridview:-</p>
  
  <pre><code>private void BindGrid()
      {
          string strQuery = "select Id,page_title,page_description,meta_title,meta_keywords,meta_description,Active from tbl_Pages ORDER By Id DESC";
          SqlCommand cmd = new SqlCommand(strQuery);
          DataTable dt = GetData(cmd);
          grdCSRPageData.DataSource = dt;
          grdCSRPageData.DataBind();
      }
  </code></pre>
  
  <p>Also see the <code>Page_load</code> method;-</p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
      {
          if (!IsPostBack)
          {  
              BindGrid();
          }
      }
  </code></pre>