How to get selected row data from popup Gridview
<p>I have created Following GridView with CheckBox field.CheckBoxes are used to get the Selected(checked) row data when Clicking Submit button.
It works fine without error.</p>

<pre><code>&lt;div id="dialog2" style="display:none" &gt;
    &lt;asp:GridView ID="GvSalesItems" runat="server" AutoGenerateColumns="False" DataKeyNames="sno" CellPadding="4" ForeColor="#333333" GridLines="None" PageSize="10" AllowPaging="True"&gt;
    &lt;AlternatingRowStyle BackColor="White" ForeColor="#284775" /&gt;
        &lt;Columns&gt;
            &lt;asp:TemplateField&gt;
                &lt;HeaderTemplate&gt;
                    &lt;asp:CheckBox ID="checkAll" runat="server" onclick = "checkAll(this);" /&gt;
                &lt;/HeaderTemplate&gt;
                &lt;ItemTemplate&gt;
                    &lt;asp:CheckBox ID="chk" runat="server" onclick = "Check_Click(this)" /&gt;
                &lt;/ItemTemplate&gt;
            &lt;/asp:TemplateField&gt;
            &lt;asp:TemplateField&gt;
                &lt;ItemTemplate&gt;
                    &lt;asp:LinkButton ID="lnkSelect" runat="server" Text="Select" CommandName = "Select" OnClientClick = "return GetSelectedRow(this)" /&gt;
                &lt;/ItemTemplate&gt;
            &lt;/asp:TemplateField&gt;

            &lt;asp:BoundField DataField="sno" HeaderText="Sno" /&gt;
            &lt;asp:BoundField DataField="itemcode" HeaderText="Item Code" /&gt;
            &lt;asp:BoundField DataField="itemname" HeaderText="Item Name" /&gt;
        &lt;/Columns&gt;
    &lt;/GridView&gt;
</code></pre>

<p>C# function for Submit Button</p>

<pre><code>protected void btnItemSave_Click(object sender, EventArgs e)
{
    foreach (GridViewRow gvrow in GvSalesItems.Rows)
    {
        CheckBox chk = (CheckBox)gvrow.Cells[0].FindControl("chk");
        if (chk.Checked)
        {
            int sno = int.Parse(gvrow.Cells[2].Text);
            int invoiceno = Convert.ToInt32(LblInvoiceAuto.Text);
            string itemcode = gvrow.Cells[3].Text;
            string itemname = gvrow.Cells[4].Text;
            dt.Rows.Add(sno,invoiceno, itemcode, itemname);
        }
    }
}
</code></pre>

<p>Now i want to show this GridView in Popup, Hence i am using Following JavaScript function.But, checkbox function is not working now.</p>

<pre><code>&lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"&gt;&lt;/script&gt;
&lt;script src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.9/jquery-ui.js" type="text/javascript"&gt;&lt;/script&gt;
&lt;link href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.9/themes/start/jquery-ui.css"
    rel="stylesheet" type="text/css" /&gt;
&lt;script type="text/javascript"&gt;
    $(function () {
        $("[id*=btn3]").click(function () {
            ShowPopup2();
            return false;
        });
    });
    function ShowPopup2() {
        $("#dialog2").dialog({
            title: "Item GridView",
            width: 550,
            buttons: {
                Ok: function () {
                    $(this).dialog('close');
                }
            },
            modal: true
        });
    }
&lt;/script&gt;
</code></pre>