How to check if GridValue has at least one item in asp.net
<p>I have a GridView that uses a query-string to populate when it loads initially.  If the ID in the query-string is a new ID then the user will not see the GridView at all;  but the user has the option to click the Insert Button then the GridView will show up and they should be able to insert a new data.  After the user inserts a new item then the user will click another button to send an email out to some group.  My issue is that sometimes the users send the email out before they add a new item in the gridview.  I want to make sure that the GridView is shown on the page and has at least one item and then the user should be able to send the email out to any group.  Is there a way to check that the GridView is shown and has at least one item in it?</p>

<pre><code>asp:GridView ID="GV_Action" runat="server" AutoGenerateColumns="False" CellPadding="2"
            DataKeyNames="ID" ForeColor="Black" GridLines="None" OnRowCancelingEdit="GV_Action_RowCancelingEdit"
            OnRowDeleting="GV_Action_RowDeleting" OnRowEditing="GV_Action_RowEditing" 
                OnRowUpdating="GV_Action_RowUpdating" Width="900px" 
                BackColor="LightGoldenrodYellow" BorderColor="Tan" BorderWidth="1px"&gt;
            &lt;FooterStyle BackColor="Tan" /&gt;
            &lt;Columns&gt;
                &lt;asp:BoundField DataField="ID" HeaderText="ID" ReadOnly="True" &gt;
                &lt;HeaderStyle HorizontalAlign="Left" /&gt;
                &lt;/asp:BoundField&gt;
                &lt;asp:TemplateField HeaderText="RCA ID"&gt;
                    &lt;EditItemTemplate&gt;
                        &lt;asp:TextBox ID="txtPostID" runat="server" Width="0px" ReadOnly="true" 
                            text='&lt;%# Request.QueryString["Post_ID"] %&gt;' Height="0px"&gt;&lt;/asp:TextBox&gt;
                    &lt;/EditItemTemplate&gt;

            &lt;/Columns&gt;
            &lt;RowStyle HorizontalAlign="Left" /&gt;
            &lt;SelectedRowStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" /&gt;
            &lt;PagerStyle BackColor="PaleGoldenrod" ForeColor="DarkSlateBlue" 
                HorizontalAlign="Left" /&gt;
            &lt;HeaderStyle BackColor="Tan" Font-Bold="True" HorizontalAlign="Left" /&gt;
            &lt;AlternatingRowStyle BackColor="PaleGoldenrod" /&gt;
            &lt;SortedAscendingCellStyle BackColor="#FAFAE7" /&gt;
            &lt;SortedAscendingHeaderStyle BackColor="#DAC09E" /&gt;
            &lt;SortedDescendingCellStyle BackColor="#E1DB9C" /&gt;
            &lt;SortedDescendingHeaderStyle BackColor="#C2A47B" /&gt;
        &lt;/asp:GridView&gt;
</code></pre>

<p>here is my bind code:</p>

<pre><code> private void BindData_Action()
    {


        SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["TestConnectionString"].ConnectionString);
        SqlDataAdapter da = new SqlDataAdapter("SELECT ID, name,  Assigned_To, Target_Date,  Ticket_Change_Control_Number  FROM MyTable  WHERE ID = '" + Request.QueryString["ID"] + "'", con);
        DataTable dt = new DataTable();
        da.Fill(dt);
        GV_Action.DataSource = dt;
        GV_Action.DataBind();
    }
</code></pre>
